Solved

POS/ getElementById - multiple similar ID tags on Html page

Posted on 2006-11-11
6
302 Views
Last Modified: 2012-08-13
I'm using the following call to activate s submit button on a web form (VB code below, web form html at end of this post):

wb.Document.getElementById("ResultsForm").submit

This works fine.  However, on pages that have mutiple "ResultsForm" ids (see html code below), I need to be able to specify which "ResultsForm" submit button I want to activiate.  I tried,

wb.Document.getElementById("ResultsForm")(3).submit
wb.Document.getElementById("ResultsForm").submit(3)

Neither worked.  What's the correct syntax here?  Thanks

(html from page, a page can have X number of ResultsForm ids.  NO, I have no control over the HTML/tags on the page)

      <form method="POST" action="details_ACH.cfm?aba=231082826" name="ResultsForm">
    <a href="details_ACH.cfm?aba=231082826">2310-8282-6</a>
      

 <input size="-4" type="submit" size="-4" name="details" VALUE="More ..." >
      </form>

                        
                  
                  </font>
                  </td>
            <td bgcolor="#F2F2F2">
      
                  ATLANTIC EMPL FCU                  
                  
                  </td>
            <td bgcolor="#F2F2F2">
                  NEWTOWN SQUARE      
                  
                  </font>
                  </td>      
    <td bgcolor="#F2F2F2">
     
        PA
       
     </td>
                  
<!-- End of table row -->
            </tr>

      <tr valign=top>
            <td bgcolor="#F2F2F2">            

                  2
                  </td>
            <td bgcolor="#F2F2F2">
                  
                  
                  

                        
 


            

      <form method="POST" action="details_ACH.cfm?aba=231170136" name="ResultsForm">
    <a href="details_ACH.cfm?aba=231170136">2311-7013-6</a>
      

 <input size="-4" type="submit" size="-4" name="details" VALUE="More ..." >
      </form>

                        
                  
                  </font>
                  </td>
            <td bgcolor="#F2F2F2">
      
                  LEHMAN BROTHERS BANK, FSB          
                  
                  </td>
            <td bgcolor="#F2F2F2">
                  WILMINGTON          
                  
                  </font>
                  </td>      
    <td bgcolor="#F2F2F2">
     
        DE
       
     </td>
                  
<!-- End of table row -->
            </tr>

      <tr valign=top>
            <td bgcolor="#F2F2F2">            

                  3
                  </td>
            <td bgcolor="#F2F2F2">
                  
0
Comment
Question by:adorenbaum
  • 2
  • 2
  • 2
6 Comments
 
LVL 11

Expert Comment

by:Dany Balian
ID: 17925049
i dont think u can do it...
because ids assume that u have one id per page...
so each name should be unique!!

what u can do is name them... resultsform1, 2, 3, 4...
and then use: getElementById("ResultsForm1").submit

cheers,

dan
0
 

Author Comment

by:adorenbaum
ID: 17925122
Dan,

As I mention in my original post,  I cannot control the html so I can't rename etc.
0
 
LVL 28

Accepted Solution

by:
Ark earned 250 total points
ID: 17928510
wb.Document.Forms("ResultsForm", 3).submit
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:adorenbaum
ID: 17930631
Thanks.  That did the trick.
0
 
LVL 11

Expert Comment

by:Dany Balian
ID: 17930794
*blush*
although it contradicts with its name, i didnt think a page could have different objects with same ids..
anyways, everyday we learn new stuff ;)

glad that the case is solved!

and good luck on the remainder of ur project!

dan
0
 
LVL 28

Expert Comment

by:Ark
ID: 17934907
Thanks for points, glad I could help
mrdany, forms are 'special' objects, which does can have same ids, while another objects can not
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question