Results 1 to 9 of 9

Thread: How can you submit a form in a webbrowser based solely on its submit button name?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195

    How can you submit a form in a webbrowser based solely on its submit button name?

    Lets say a form has a submit button, and its text is 'Post'

    (<INPUT TYPE="submit" VALUE="Post"> )

    how can you submit that button by using its value?

    Anyone know?

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    VB Code:
    1. For x = 0 To WB.Document.forms(0).elements.length
    2.   If WB.Document.forms(0).elements(x).Value = "Post" Then
    3.     WB.Document.forms(0).elements(x).submit()
    4.     Exit For
    5.   End If
    6. Next x

    Something similar to that.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    but what if the form is not certain? like.. the post can be in form,2,3,4, or even more..

  4. #4
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Originally posted by qpabani
    but what if the form is not certain? like.. the post can be in form,2,3,4, or even more..
    You should be able to loop through the forms, too.
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    how ?

    i dont know how many forms there are on a page.. is there a variable that contains this number?

  6. #6
    Frenzied Member
    Join Date
    Mar 2001
    Location
    You are HERE •™
    Posts
    1,300
    Maybe something like this:
    VB Code:
    1. Dim x as Long
    2. Dim y as Long
    3.  
    4. For y = 0 To WB.Document.forms.length - 1
    5.   For x = 0 To WB.Document.forms(y).elements.length - 1
    6.     If WB.Document.forms(y).elements(x).Value = "Post" Then
    7.       WB.Document.forms(y).elements(x).submit()
    8.       Exit For
    9.     End If
    10.   Next x
    11. Next y

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    yay it looks good

    gonna try it now on my brand spankin new visual studio.net :P

  8. #8
    Frenzied Member
    Join Date
    Mar 2001
    Location
    You are HERE •™
    Posts
    1,300
    Try changing this line:
    WebBrowser1(0).Document.Forms(y).elements(x).submit
    ------To this line------
    WebBrowser1(0).Document.Forms(y).submit

    -OR-

    Try using "Click" instead of "submit"
    WebBrowser1(0).Document.Forms(y).elements(x).Click

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2000
    Posts
    1,195
    thanks bloodeye..

    how do you know sooo much about dhtml/webbrowser control?

    youre a genius !

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