I have an basic HTML page that has one editable text field and one "Search" button. Test Page
In B4A, I have a layout that has one EditText field and one Button. I'd like to be able to enter something in the EditText field and then, when clicking on the button, it would launch a WebView that copies the EditText contents to the HTML editable field and then clicks on "Search" in the html and displays the corresponding result.
I've done this in VB before but not sure if this is do-able in B4A.
Here's what I got so far:
In the HTML, the 2 fields i'd like to interact with are:
Editable textbox
Search Button:
In B4A, I have a layout that has one EditText field and one Button. I'd like to be able to enter something in the EditText field and then, when clicking on the button, it would launch a WebView that copies the EditText contents to the HTML editable field and then clicks on "Search" in the html and displays the corresponding result.
I've done this in VB before but not sure if this is do-able in B4A.
Here's what I got so far:
B4X:
Sub Process_Globals
Dim hc As HttpClient
End Sub
Sub Globals
Dim Button1 As Button
Dim EditText1 As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout(1)
If FirstTime Then
hc.Initialize("hc")
End If
'
' Dim req As HttpRequest
' req.InitializeGet("http://dl.dropbox.com/u/14738173/test.html")
' hc.Execute(req, 1)
End Sub
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Dim resultString As String
resultString = Response.GetString("UTF8")
'Work with the result
End Sub
Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
Log("Error connecting: " & Reason & " " & StatusCode)
If Response <> Null Then
Log(Response.GetString("UTF8"))
Response.Release
End If
End Sub
Sub Button1_Click
Dim req As HttpRequest
If EditText1.Text<>"" Then
req.InitializeGet("http://dl.dropbox.com/u/14738173/test.html")
hc.Execute(req, 1)
Else
Msgbox("Enter something in editbox","")
End If
End Sub
In the HTML, the 2 fields i'd like to interact with are:
Editable textbox
HTML:
<input id="TestNo" name="TestNo" value="">
Search Button:
HTML:
<input type="submit" value="Search" name="submit_button">