Android Question Webview html form submit issue

hung

Active Member
Licensed User
Longtime User
I have an old app (sdk version 28) had been running well as below for more than a year.

1. app sends parameters to backend server using codes below
...
Private wv_scanlocation As WebView
...
Dim lHttpJob As HttpJob ' use local resource to avoid crash
lHttpJob.Initialize(strjob, Me)
lHttpJob.PostString(gUrl, strparam)
...

Sub JobDone (Job As HttpJob)
If Job.Success = True Then
Select Job.JobName
...
Case "scanlocation"
wv_scanlocation.LoadHtml(Job.GetString)
...

2. backend server response with a data entry form with a submit button to the app screen
...
<form id=scanpickuppcs method=post action="https://xxxx.com/abc">
<table>
<tr><td>Seal <%=req("fld6")%> saved </td></tr>
<tr><td>No.of items pickuped: <input type=text name=fld7> </td></tr>
<tr><td><input class=btnSubmit type=submit name=submit value="Submit"></td></tr>
</table>
</form>
...
3. when user click Submit button. the data entered will submit to back end server

But recently I found the following issue
- in step 3, when user click, I could see Submit button is pressed down but no form data is sent to backend server

I tried to recompile app as version 30 but that did not solve the problem.

Any body has any hints to solve this? Thanks.
 

Magma

Expert
Licensed User
Longtime User
Hi there...

let me see if understand

1. You set the parameters...and actually download the html to a string (job.getstring)

2. You just showing with webview the html from string.... end-user press the submit of form - loaded by html string....you want the backend server response ? (if https is somehow difficult i think)

... you may be need web browse the link/url direct...
start with only
B4X:
wv_scanlocation.LoadUrl(urlpostaction & "?" & params)  ' params can be fld7=yourtext&fld6=neededval

ofcourse if only support GET... but sometimes you can bypass and needed POST fields... never know

or use job poststring at url "post action" with needed fields...

You must actually know the fields and the security of site for the form... if has Google reCaptcha I think is difficult...


ps: <%=req("fld6")%> that seems like classic asp... strange... to get the code of html/asp ...may be there is a server prob...
 
Upvote 0

hung

Active Member
Licensed User
Longtime User
Hi there...

let me see if understand

1. You set the parameters...and actually download the html to a string (job.getstring)

2. You just showing with webview the html from string.... end-user press the submit of form - loaded by html string....you want the backend server response ? (if https is somehow difficult i think)

... you may be need web browse the link/url direct...
start with only
B4X:
wv_scanlocation.LoadUrl(urlpostaction & "?" & params)  ' params can be fld7=yourtext&fld6=neededval

ofcourse if only support GET... but sometimes you can bypass and needed POST fields... never know

or use job poststring at url "post action" with needed fields...

You must actually know the fields and the security of site for the form... if has Google reCaptcha I think is difficult...


ps: <%=req("fld6")%> that seems like classic asp... strange... to get the code of html/asp ...may be there is a server prob...
Thank you Magma.

Turn out I found the issue is the ssl cert of our https://www..... site has expired. When change to another https with valid ssl cert all scripts work.

@Erel , I did try to set condition symbol "HU2_ACCEPTALL" in Build Configuration to compile app. I recall that worked once but not working now.
 
Upvote 0
Top