|
-
Jan 25th, 2002, 06:48 PM
#1
Thread Starter
Frenzied Member
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?
-
Jan 25th, 2002, 07:00 PM
#2
VB Code:
For x = 0 To WB.Document.forms(0).elements.length
If WB.Document.forms(0).elements(x).Value = "Post" Then
WB.Document.forms(0).elements(x).submit()
Exit For
End If
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
-
Jan 25th, 2002, 07:40 PM
#3
Thread Starter
Frenzied Member
but what if the form is not certain? like.. the post can be in form,2,3,4, or even more..
-
Jan 25th, 2002, 07:41 PM
#4
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
-
Jan 25th, 2002, 07:53 PM
#5
Thread Starter
Frenzied Member
how ?
i dont know how many forms there are on a page.. is there a variable that contains this number?
-
Jan 25th, 2002, 08:38 PM
#6
Frenzied Member
Maybe something like this:
VB Code:
Dim x as Long
Dim y as Long
For y = 0 To WB.Document.forms.length - 1
For x = 0 To WB.Document.forms(y).elements.length - 1
If WB.Document.forms(y).elements(x).Value = "Post" Then
WB.Document.forms(y).elements(x).submit()
Exit For
End If
Next x
Next y
-
Jan 25th, 2002, 08:48 PM
#7
Thread Starter
Frenzied Member
yay it looks good 
gonna try it now on my brand spankin new visual studio.net :P
-
Jan 26th, 2002, 09:30 AM
#8
Frenzied Member
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
-
Jan 26th, 2002, 02:42 PM
#9
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|