busycoder
asked on
I need to call the onchange event after setting the value of a select - option html object in a page
I am using FoxPro to do some automation of an external Internet explorer page. I can set the value just fine, but can't seem to get the page to run whatever code it wants to that in this case makes visible another select - option pick list to choose from.
The event seems to be the onchange event, but I can't seem to call it properly to get it to work.
The event seems to be the onchange event, but I can't seem to call it properly to get it to work.
ie.Document.getElementsByTagName('select').[1].value='somevalue'
Are you changing the value of the 1st OPTION of the SELECT or are you changing the selection. The OnChange should run when you change the selection, not when you change the value of the 1st OPTION.
ASKER
Here is the html code for an example page.
<select onchange="alert('Changed') ">
<option value="one" >One</option>
<option value="two" >Two</option>
<option value="three" >Three</option>
</select>
Here is the foxpro line that successfully changes the value, but does not fire the onchange event:
ie.Document.getElementsByT agName('se lect').[0] .value='tw o'
Since not all selects that I run into have a name it has to be called this way.
<select onchange="alert('Changed')
<option value="one" >One</option>
<option value="two" >Two</option>
<option value="three" >Three</option>
</select>
Here is the foxpro line that successfully changes the value, but does not fire the onchange event:
ie.Document.getElementsByT
Since not all selects that I run into have a name it has to be called this way.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Really helped me out, thanks guys for troubleshooting this and giviing me the solution.