Replace the Go button on the soft keyboard with Next in Phonegap

Enter the text of the text message in the form of a phone book. Go to the soft keyboard, I have several text fields, so you want to click the "Next" button on the keyboard so that the user can easily navigate and want on the last entry. Go so the user can click to submit the form.

enter image description here

And on the top panel of the Android kitkatt keyboard, the Next | Prev.

+12
android cordova
May 05 '14 at 10:38
source share
1 answer

The presence of the "Next" button instead of the "Go" for the input type = "text" on Android will now be unavailable.

Android will always display the Go button for form input fields regardless of the position of the field you are in on the form. "Go" basically reflects the same behavior as the "Enter" button on a regular browser and keyboard.

There are two possible hacks to get closer to what you need ("Go" will not change to "Next" yet, but it will help "Go" act like "Next") -

Hack 1 - Hijack Enter a key event and move the focus to the following fields

As I mentioned, the "Go" key replicates the "Enter" key, you can capture the key input event using JavaScript and make it move the focus to the next form fields to its last field. Once the last field reaches, you can let it act as input. So basically Go will continue to move the focus to the next fields until its last field, and then it will submit the form.

I answered the solution of a similar requirement here - How to call the tab when the user presses Enter , you can try to implement it in your application.

DEMO LINK - http://codepen.io/nitishdhar/pen/Gxbhm

Hack 2 - force form validation and focus shifting to the following invalid fields

If you want to prevent users from submitting a form, you can put the necessary validations into the form using java-script and, if any field is empty, clicking “Go” can move the focus of the cursor to the next “empty” field. Thus, giving the impression - "Press Go and go to the next field that you need to fill in"

Try this plugin - http://jqueryvalidation.org/ , it behaves as explained, i.e. moves focus to the next required or invalid field.

I also think that some versions of android show some tab key on the keyboard to move between fields, but not its Next.

All the best.

+23
May 24 '14 at
source share



All Articles