Android Question Get the form data from a webview

Phayao

Active Member
Licensed User
Longtime User
Sorry for asking as stupid question, but I could not figure out how do I get the content of form data that are in html in a webview ? And what to put as target in this form ? There is this "getSaveForm" setting in webview but that's only yes or no.
Thank you for any hint

Chris
 

Peter Simpson

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
Thank you Peter !
It's a solution but not the perfect one - I dont want to get the whole html code, only the content of the form fields inside a webview.
Alternatively the html page could send the form data to another html which only shows the sended fields and then get the content of that second page.
Will try out !

Thanks, Chris
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Thank you Peter !
It's a solution but not the perfect one - I dont want to get the whole html code, only the content of the form fields inside a webview.
Alternatively the html page could send the form data to another html which only shows the sended fields and then get the content of that second page.
Will try out !

Thanks, Chris

Use WebViewExtras to add a JavaScript interface to your WebView.
Now javascript in your loaded webpage can call b4a subs and pass data to them.

You then need to execute some javascript in your loaded webpage that gets your form values and calls a b4a sub passing these values.

Do you have any JavaScript skills?
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
Thank you, that's a good idea I didn't think about !
JS is no problem but how can you call a B4A sub from within the webview ? Just using the sub name ?
Thanks again,
Chris
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
JS is no problem but how can you call a B4A sub from within the webview ?
See the javascript-interface doku (+ examples) and you will know. If you are familar to javascript then you´ll easy implement things
 
Last edited:
Upvote 0
Top