Solved

POS/ getElementById - multiple similar ID tags on Html page

Posted on 2006-11-11
6
299 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 27

Accepted Solution

by:
Ark earned 250 total points
ID: 17928510
wb.Document.Forms("ResultsForm", 3).submit
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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 27

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

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…
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 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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

786 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