Android Question Webbrowser Keyboard control DONE

Rusty

Well-Known Member
Licensed User
Longtime User
Is there a way to force the Android Keyboard shown in a webbrowser:
B4X:
Dim WebView1 As WebView
    Dim WebViewExtras1 As WebViewExtras
    Dim WebViewSetting1 As WebViewSettings
...
WebView1.Initialize("WWW") 
    WebView1.JavaScriptEnabled=True
    WebViewExtras1.addJavascriptInterface(WebView1, "B4A") 
    WebViewExtras1.addWebChromeClient(WebView1,"Chrome")
    WebViewSetting1.setDatabaseEnabled(WebView1, True)
    WebViewSetting1.setDatabasePath(WebView1, "")
    Activity.AddView(WebView1, 0, 0, 100%x, 100%y)
    WebView1.LoadUrl("file:///android_asset/journey1.htm")
...
HTML:
<form action="/form/button" action="get">
<label class="question top_question" for="q2">
What was it?&nbsp;<b class="icon_required" style="color: #FF0000">*</b>
</label>
<textarea name="q2" rows="3" style="width: 100%">
</textarea>
<input type="submit" name="q2" class="OK" value="OK" />
</form>>

Currently, the keyboard shows an (CrLF) key. I'd like to execute a DONE operation so the JScript will execute.
Is there a way to get a keyboard DONE function from this?
Regards,
Rusty
 

Rusty

Well-Known Member
Licensed User
Longtime User
Thanks Erel,
I updated the Webview1.Loadurl to:
B4X:
WebView1.LoadUrl(XUI.FileUri(File.DirAssets, "journey1.htm"))
However, I fail to understand how to "force it" to allow the Enter Key to function like a DONE key, or possibly intercept keystrokes from the Webview prior to their consumption by the Webview...?
Thanks for your (or anyone's) help.
Rusty

PS I found this managing-keyboard-on-webview but have no idea how to import this into B4a...
Advice would be appreciated :)
 
Last edited:
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
I have HTML that is interspersed with labels; text; unordered and ordered lists; etc.
Also embedded are <input textareas (because I need to use multiple lines and long text lengths that are longer than the width of the screen...allowed by <input text)
i.e.:
B4X:
<form action="/form/button" action="get">
<label class="question top_question" for="q1">
What happened?&nbsp;<b class="icon_required" style="color: #FF0000">*</b>           
<textarea name="q1" rows="3" style="width: 95%"></textarea>
<br />
<br />
<input type="submit" name="q1" class="OK" value="Next >" /> 
<br />
<br />
</form>

I've added the submit button due to the inability to force the DONE button or to intercept the keystrokes as they come in.
I prefer to allow them to click the DONE button to proceed to the next textarea.
Maybe there is a better way ?
Thanks
Rusty
 
Upvote 0
Top