Jump to content

Recommended Posts

Posted (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 by Magikarp7
Wrong variables.
Posted

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

My resources are limited. You must ask the right questions

 

Posted
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.

Posted (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 by Earthshine

My resources are limited. You must ask the right questions

 

Posted
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.

Posted

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

 

  • 3 weeks later...
Posted (edited)

Magikarp7,

Do you have a url to test with?

kylomas   

Edited 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...