Solved

POS/ getElementById - multiple similar ID tags on Html page

Posted on 2006-11-11
6
309 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

690 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