|
-
Sep 13th, 2009, 12:44 PM
#1
Thread Starter
Lively Member
[RESOLVED] Entering text in a textbox
How can i enter text in a textbox present in a webpage from another trextbox named text4 in my form ?
The source code of the text box in the webpage is:
Code:
<p class="center"><input type="text" name="Validate" size="6" maxlength="6" /><br />
Last edited by DragonBoy; Sep 15th, 2009 at 07:59 AM.
-
Sep 13th, 2009, 01:26 PM
#2
Addicted Member
Re: Entering text in a textbox
-
Sep 14th, 2009, 11:10 AM
#3
Addicted Member
Re: Entering text in a textbox
Try this:
vb Code:
Option Explicit Private Function getBonusFormTextBoxValue() As String Dim oHTMLDoc As HTMLDocument, oEle As IHTMLElement, oForm As IHTMLFormElement, szValue As String '<form action="/bonus.php" method="POST"> ' <p class="center">Combination:<br /> ' <img src="validate_image.php?id=907af914b95a0fc33c3f33bf6b4f1ec9f4b5c8207f8fc29522efe783d" ' alt="Validation Image" /> ' </p> ' <p class="center"> ' <input type="text" name="Validate" size="6" maxlength="6" /> ' <br /> ' <input type="submit" value="Enter Combination!" /> ' </p> '</form> '<hr style="clear: both" /> '<p class="center"><img src="/graphics/pokemon/normal/393M.gif" alt="A Wild Pokémon!"> ' <br /> ' <strong style="color: red">Look out!</strong> A wild Pokémon has attacked you!<br /> ' <a href="battle.php?Battle=Wild">Battle it now!</a> '</p> '<p> </p> '<p class="center"> 'WebBrowser1.navigate "about:blank" Set oHTMLDoc = WebBrowser1.document 'oHTMLDoc.body.innerHTML = "<form action=""/bonus.php"" method=""POST""><p class=""center"">Combination:<br /><img src=""validate_image.php?id=907af914b95a0fc33c3f33bf6b4f1ec9f4b5c8207f8fc29522efe783d"" alt=""Validation Image"" /></p><p class=""center""><input type=""text"" name=""Validate"" size=""6"" maxlength=""6"" /><br /><input type=""submit"" value=""Enter Combination!"" /></p></form><hr style=""clear: both"" /><p class=""center""><img src=""/graphics/pokemon/normal/393M.gif"" alt=""A Wild Pokémon!""><br /><strong style=""color: red"">Look out!</strong> A wild Pokémon has attacked you!<br /><a href=""battle.php?Battle=Wild"">Battle it now!</a></p><p> </p><p class=""center"">" szValue = vbNullString For Each oForm In oHTMLDoc.Forms If (InStr(1, oForm.Action, "bonus.php", vbTextCompare) <> 0) Then For Each oEle In oForm.elements If (oEle.isTextEdit) Then If (LCase(oEle.Name) = "validate") Then szValue = oEle.Value Set oEle = Nothing Set oForm = Nothing Exit For End If End If Next oEle End If If (oForm Is Nothing) Then Exit For Next oForm getBonusFormTextBoxValue = szValue End Function Private Sub Form_Load() getBonusFormTextBoxValue End Sub
-
Sep 15th, 2009, 08:00 AM
#4
Thread Starter
Lively Member
Re: Entering text in a textbox
Xiphias3:I tried it but even though it wasn't giving me an error it's still not entering the code in that textbox !
Got any simpler way
-
Sep 17th, 2009, 12:22 AM
#5
Thread Starter
Lively Member
Re: Entering text in a textbox
Resolved.
I used:
Code:
For Each formtext In WebBrowser1.Document.getelementsbytagname("input")
If formtext.Name = "name of element" Then
formtext.Value = Text4.Text
End If
Next
Last edited by DragonBoy; Sep 17th, 2009 at 01:05 AM.
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
|