View Single Post
06-11-20, 10:17 AM   #6
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Antiklesys View Post
I'm trying to do a "Submit" form.

In your case it might be easier to just use a StaticPopupDialog, you can reference StaticPopup.lua for more detailed examples
Lua Code:
  1. local someVar
  2.  
  3. -- /run StaticPopup_Show("TestPopup")
  4. StaticPopupDialogs.TestPopup = {
  5.     text = "Some text",
  6.     button1 = OKAY,
  7.     OnAccept = function(self)
  8.         someVar = self.editBox:GetText()
  9.         print(someVar)
  10.     end,
  11.     hasEditBox = 1,
  12. }


There is also the AceConfig input option if you want more full fledged options


Originally Posted by Antiklesys View Post
I'm struggling with this as I don't seem to understand how the "Okay" button has been generated in the first place as it doesn't seem to be part of the code?

The "Okay" button there is part of the DialogBox frame template

Here is an ugly example using the global variables because apparently I didn't bother making them accessible as keys at that time
Lua Code:
  1. local someVar
  2.  
  3. KethoEditBoxButton:HookScript("OnClick", function(self)
  4.     someVar = KethoEditBoxEditBox:GetText()
  5.     print(someVar)
  6. end)
  Reply With Quote