Magikarp7 Posted December 31, 2017 Share Posted December 31, 2017 (edited) Hi. I am currently making a program for my office and I am having serious trouble with the "onclick" event in IE. The scenario is that I am given a selection of radioboxes and an "Ok" button. What I need to do is when I click the "Ok" button, the radiobox that is checked should give me a messagebox with the value I assigned for it. The problem is that if I check random radioboxes until I choose the final one and then click the OK button, the messagebox repeatedly appears, giving me the last radiobox in the messagebox depending on how many times I "randomly" check a radiobox in IE. Please help me. someone. Here is a sample code. AdlibRegister("MyFunc") Func MyFunc() If WinExists($exitWindow) then $ToolExit = _IEAttach("Exit -- Webpage Dialog", "embedded") $ExitForm = _IEFormGetObjByName($ToolExit, "form") $SiteExitOkbtn = _IEGetObjById($ToolExit, "okButton") ;THE RADIOBOXES If(_IEFormElementRadioSelect($ExitForm, "Exit:1", "Option", -1, "byValue")) Then $Variable = "You clicked radiobox exit 1" ElseIf(_IEFormElementRadioSelect($ExitForm, "Exit:2", "Option", -1, "byValue")) Then $Variable = "You clicked radiobox exit 2" ElseIf(_IEFormElementRadioSelect($ExitForm, "Exit:3", "Option", -1, "byValue")) Then $Variable = "You clicked radiobox exit 3" ElseIf(_IEFormElementRadioSelect($ExitForm, "Exit:4", "Option", -1, "byValue")) Then $Variable = "You clicked radiobox exit 4" ElseIf(_IEFormElementRadioSelect($ExitForm, "Exit:5", "Option", -1, "byValue")) Then $Variable = "You clicked radiobox exit 5" ElseIf(_IEFormElementRadioSelect($ExitForm, "Exit:6", "Option", -1, "byValue")) Then $Variable = "You clicked radiobox exit 6" ElseIf(_IEFormElementRadioSelect($ExitForm, "Exit:7", "Option", -1, "byValue")) Then $Variable = "You clicked radiobox exit 7" EndIf $oevent = ObjEvent($SiteExitOkbtn, "_EXIT_CLICK_HANDLER_") Endif EndFunc Func _EXIT_CLICK_HANDLER_onclick() AdlibUnregister("MyFunc") MsgBox(0,"","You chose " & $Variable & "!!!") EndFunc ;==>_EXIT_CLICK_HANDLER_onclick I think it has something to do with the ObjEvent. I'm at my limits on that function. Can someone help me? I just need to get the value of the final radiobox checked when I click the Ok Button. but the messagebox keeps reappearing. Edited December 31, 2017 by Magikarp7 Wrong variables. Link to comment Share on other sites More sharing options...
Earthshine Posted December 31, 2017 Share Posted December 31, 2017 Well the way you’ve written it every time you click a radioboxx it sets a variable maybe you don’t want to record every time you click just when you hit the OK button check which radioboxx is on Magikarp7 1 My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Magikarp7 Posted December 31, 2017 Author Share Posted December 31, 2017 22 minutes ago, Earthshine said: Well the way you’ve written it every time you click a radioboxx it sets a variable maybe you don’t want to record every time you click just when you hit the OK button check which radioboxx is on Hi thank you for the reply! Do you have any idea how I can fix this? I tried putting the radiobutton statements inside the "onclick" function to no avail. Any help would be appreciated. Link to comment Share on other sites More sharing options...
Earthshine Posted December 31, 2017 Share Posted December 31, 2017 (edited) All you need to be able to do is, when the OK button is clicked evaluate which of the radio buttons has been click and return the proper message string at That time I’m on holiday right now but when I get back to work I can probably dig something up Edited December 31, 2017 by Earthshine My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Magikarp7 Posted December 31, 2017 Author Share Posted December 31, 2017 7 minutes ago, Earthshine said: All you need to be able to do is, when the OK button is clicked evaluate which of the radio buttons has been click and return the proper message string at That time I’m on holiday right now but when I get back to work I can probably dig something up Thanks man. is there any way you can make an example when you get back? All I really know is the objevent function I made. I think there are still other functions for the IE onclick event I don't know yet. Thank you. Link to comment Share on other sites More sharing options...
Earthshine Posted December 31, 2017 Share Posted December 31, 2017 Put the radio box code that you have inside another function called get-radio-box Then call that function when you’re OK button gets clicked My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
kylomas Posted January 16, 2018 Share Posted January 16, 2018 (edited) Magikarp7, Do you have a url to test with? kylomas Edited January 16, 2018 by kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now