469,090 Members | 1,196 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,090 developers. It's quick & easy.

One last WebBrowser DOM question...

One last question and I will have my application working the way that I
need...

How can you put a value into a specific field on a specific form?

If you look at the webpage sample below you will see that there are three
forms on the page. Each form has a unique name, but the input tags are
duplicated on each form.

How would I (for example) assign the value "Bob" to the input box named
"username" on the form named "FormTwo" in VB6 using the WebBrowser DOM???

<html>
<head>
</head>
<body>
<form name="FormOne" action = "">
Name: <input type="text" name ="username"> <br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
<hr>
<form name="FormTwo" action = "">
Name: <input type="text" name ="username"> <br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
<hr>
<form name="FormThree" action = "">
Form3<br>
Name: <input type="text" name ="username"> <br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
</body>
</html>
Jul 17 '05 #1
3 4255
There may be an easier way than this but offhand:
You can always get anything with "all". From the
all element collection, in a loop, you can look for
elements with tagName = "INPUT", then find the
one with the right name property. They also have
a "type" property. (Text, Password, etc.)
One last question and I will have my application working the way that I
need...

How can you put a value into a specific field on a specific form?

If you look at the webpage sample below you will see that there are three
forms on the page. Each form has a unique name, but the input tags are
duplicated on each form.

How would I (for example) assign the value "Bob" to the input box named
"username" on the form named "FormTwo" in VB6 using the WebBrowser DOM???

<html>
<head>
</head>
<body>
<form name="FormOne" action = "">
Name: <input type="text" name ="username"> <br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
<hr>
<form name="FormTwo" action = "">
Name: <input type="text" name ="username"> <br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
<hr>
<form name="FormThree" action = "">
Form3<br>
Name: <input type="text" name ="username"> <br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
</body>
</html>

Jul 17 '05 #2

Noozer,

I once spent hours trying to figure this out. Someone on this newsgroup
told me how to do it with one line of code:

webBrowser.Document.Forms("FormOne")("username").V alue = "bob"

nate
"Noozer" <do*******@me.here> wrote in message
news:jGirc.552581$oR5.183772@pd7tw3no...
One last question and I will have my application working the way that I
need...

How can you put a value into a specific field on a specific form?

If you look at the webpage sample below you will see that there are three
forms on the page. Each form has a unique name, but the input tags are
duplicated on each form.

How would I (for example) assign the value "Bob" to the input box named
"username" on the form named "FormTwo" in VB6 using the WebBrowser DOM???

<html>
<head>
</head>
<body>
<form name="FormOne" action = "">
Name: <input type="text" name ="username"> <br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
<hr>
<form name="FormTwo" action = "">
Name: <input type="text" name ="username"> <br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
<hr>
<form name="FormThree" action = "">
Form3<br>
Name: <input type="text" name ="username"> <br>
Password: <input type="password" name="password"><br>
<input type="submit" name="submit">
</form>
</body>
</html>

Jul 17 '05 #3
Thank you VERY much!

I knew there had to be a simple way... this makes perfect sense now that I
see it.

"nate" <na**@hello.com> wrote in message
news:HZ****************@fe2.columbus.rr.com...

Noozer,

I once spent hours trying to figure this out. Someone on this newsgroup
told me how to do it with one line of code:

webBrowser.Document.Forms("FormOne")("username").V alue = "bob"

How can you put a value into a specific field on a specific form?

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Toma Marinov | last post: by
2 posts views Thread by Kurt Waldheim | last post: by
9 posts views Thread by philip | last post: by
2 posts views Thread by Ryan Ramsey | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.