Results 1 to 8 of 8

Thread: [RESOLVED] Submitting form issue

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Resolved [RESOLVED] Submitting form issue

    I'm trying to submit a form within the Webbrowser control but I can't find the 'name' or 'id' of the submit button. I can insert the Stock Code into the 'securityCode' filed but can't sumbit the form

    Below is the form and what I've tried without any luck.

    HTML Code:
    WB1.Document.getElementById("DetailedQuoteForm").submit
    and 
    WB1.Document.getElementById("DetailedQuoteForm").Click
    HTML Code:
    <form name="DetailedQuoteForm" method="post" action="/do/secure/detailedQuote">
      <input type="hidden" name="submit" value="true" />
        <table class="selector-outer" summary="ASX Codes">
            <tr>
                <td>
    
                    <table class="selector-inner" summary="ASX Codes">
                        <tr>
                            <td>
                                <label for="inputasxcode">ASX Codes:</label>
                            </td>
                            <td>
                                <input type="text" name="securityCode" maxlength="6" size="10" value="" id="inputasxcode" />
                            </td>
    
                            <td>
                                <span class="codesearch">(<a href="companyInfoSearch?url=detailedQuote_submit=true">Search for ASX Code</a>)</span>
                            </td>
                            <td>
                                <input type="submit" value="Refresh" class="button" alt="Refresh" />
                            </td>
                        </tr>
    
                    </table>
                </td>
            </tr>
        </table>
    </form>

  2. #2
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Submitting form issue

    Lintz, try
    Code:
    Dim HTML As HTMLDocument
    Dim sb As HTMLButtonElement
    
    Set HTML = wb1.Document
    Set sb = HTML.getElementsByName("submit").Item
    sb.Click

  3. #3

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Submitting form issue

    I get an error message - "user-defined type not defined" with the below line highlighted.

    Code:
    Dim HTML As HTMLDocument

  4. #4
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Submitting form issue

    You need to add the referrence to "Microsoft HTML Object Library " under project > reference . please try.

  5. #5

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Submitting form issue

    Added reference and goes through your code without error but after 'sb.click' nothing happens. It's like the button hasn't been pressed?

  6. #6
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: Submitting form issue

    lintz, is this the button ?
    <input type="hidden" name="submit" value="true" />

    Is really the button is hidden ?
    Last edited by Fazi; Nov 12th, 2007 at 05:16 AM.

  7. #7

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Resolved Re: Submitting form issue

    Got it to work

    vb Code:
    1. Dim HTML As HTMLDocument
    2. Dim sb As HTMLFormElement
    3.  
    4. Set HTML = WB1.Document
    5.  
    6. Set sb = HTML.Forms("DetailedQuoteForm", 0)
    7. sb.submit

  8. #8
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: [RESOLVED] Submitting form issue

    Cool

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width