-
Mar 20th, 2013, 12:07 PM
#1
Thread Starter
Junior Member
click two input buttons in form. both buttons have the same value
Hello guys,
I have a form (see below), where I need to select a value from the select list, then I click "Go", page loads, then I select another value from the second list, then I click in the second "Go" button.
The problem is, both buttons have the same value's name ("GO").
How can I make the difference between the first and second button when clicking?
This seems to be easy, but still don't find the solution.
Thanks in advance!
Code:
<form name="countrySelection">
<select name="continent">
</select>
<input type="submit" class="go" value="GO" />
<select name="country">
</select>
<input type="submit" alt="Go" value="GO"/>
</form>
-
Mar 20th, 2013, 12:54 PM
#2
Re: click two input buttons in form. both buttons have the same value
First of all this is not VB code so it really doesn't belong here.
Second why would you have 2 submit buttons with the same value on the same form?
-
Mar 20th, 2013, 01:07 PM
#3
Re: click two input buttons in form. both buttons have the same value
Thread moved to the ASP, VB-Script forum even though it might not belong here either.
Give the elements their own name.
Code:
<input type="button" value="GO" name="firstGo" />
-
Mar 20th, 2013, 01:11 PM
#4
Thread Starter
Junior Member
Re: click two input buttons in form. both buttons have the same value
I have tried the first so far without success.
For the first button:
Code:
Set ElementCol = objIE.document.getElementsByTagName("input")
For Each btn In ElementCol
If btn.getAttribute("class") = "go" And btn.value = "GO" Then
btn.click
End If
Next
For the second button:
Code:
Set ElementCol = objIE.document.getElementsByTagName("input")
For Each btn In ElementCol
If btn.getAttribute("alt") = "go" And btn.value = "GO" Then
btn.click
End If
Next
No luck so far.
Thanks...
-
Mar 20th, 2013, 01:23 PM
#5
Re: click two input buttons in form. both buttons have the same value
-
Mar 20th, 2013, 04:19 PM
#6
Thread Starter
Junior Member
Re: click two input buttons in form. both buttons have the same value
Originally Posted by DataMiser
Second why would you have 2 submit buttons with the same value on the same form?
that's the question I ask myself. the problem is, I didn't create the page, and I am unable to change the value. I have to work with the code as it is.
-
Mar 20th, 2013, 04:21 PM
#7
Thread Starter
Junior Member
Re: click two input buttons in form. both buttons have the same value
Originally Posted by Joacim Andersson
getElementByName
can you ellaborate more of how can getElementSByName can be applied to click the first and the second Go?
-
Mar 20th, 2013, 04:22 PM
#8
Thread Starter
Junior Member
Re: click two input buttons in form. both buttons have the same value
Originally Posted by Joacim Andersson
getElementByName
can you ellaborate more of how can getElementSByName can be applied to click the first and the second Go?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|