Android Question Tab thru Webview Inputs on a form

Rusty

Well-Known Member
Licensed User
Longtime User
I have an html file that has forms within. Within each form are "input"
B4X:
form method="post" id="TSForm"
....
<div id="q3" class="q required">
<label class="question top_question" for="RESULT_TextField-3">First Name&nbsp;<b class="icon_required" style="color:#FF0000">*</b></label>
<input type="text" name="RESULT_TextField-3" class="text_field" id="RESULT_TextField-3"  size="25" value="" />
</div>
<div id="q4" class="q required">
<label class="question top_question" for="RESULT_TextField-4">Last Name&nbsp;<b class="icon_required" style="color:#FF0000">*</b></label>
<input type="text" name="RESULT_TextField-4" class="text_field" id="RESULT_TextField-4"  size="25" value="" />
</div>
...
</form>

When the form loads:
1. The focus is not on the first text entry (First Name) - how do I set the focus and force the keyboard to appear without having the user touch the entry box?
2. When the user has filled in the first name, if he touches the DONE/NEXT button, nothing happens - how do I cause the tab to advance to the next field?
Thanks in advance,
Rusty
 

Emme Developer

Well-Known Member
Licensed User
Longtime User
My question is about why you're not using layout and native views.. is easiest and i think this is the main purpose about b4x
 
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
I need to be able to create dynamic multi-screen forms with "edit texts", Radio buttons etc.
For example, if i have a question that has 5 answers vs a question with 100 answers from which to choose.
I've implemented it with .bal files, but clients want a smoother flow, so I am experimenting with html to accomplish this.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
1. Set the fcus in b4a to the Webview
2. Use Javascript to set the Focus to an Editfield inside the loaded page inside wthe webview (in activity_resume i set focus to webview and then call a javascript to set the focus to a editfield.
3. You need to open the keyboard by yourself using the ime library i think....

 

Attachments

  • wvhtml.zip
    7.8 KB · Views: 231
Upvote 0

Rusty

Well-Known Member
Licensed User
Longtime User
Thanks Don,
I just tried your example and I'm not seeing any difference than using just Webview to load the HTML.
It shows beautifully, but when I enter some data in firstname and touch done, nothing happens to advance to lastname.
Am I missing something?
I appreciate your help and the example.
Rusty

UPDATE: I noticed the TAB key on the left of the soft keyboard and touched it, THIS WORKS
Is there a way to use the GO/DONE/NEXT key to advance?
THANKS!
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The code just show how you can Focus a editfield in the webview after it has been loaded....
Nothing more.
So, if you add a ime call to open the keyboard to it then you should be able to start with the field-editing right after loading the webview.

It is just a proof of concept; not a full Solution for your problems but it should give you a start
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…