Javascript – How to get Next button on android softkeyboard in place of Go Button in phonegap

androidcordovajavascriptjquery

I am developing Phonegap application and have many inputs in application form. I am getting Go button on keyboard of android.I want to replace go button with next button. As clicking on Go button (as shown in image) submits form.
In android native we can specify next button in XML but for Phonegap how to specify next button in place of go button.?
Some Samsung devices have by default Next Prev button on top.
By Default there is Go button. I need Next but in Phonegap

By Default there is Go button. I need Next but in Phonegap. is there any plugin for specifying that for android.

Best Answer

Having a "Next" button instead of "Go" is not possible with Android as of now.

Android will always display "Go" button for form input fields. "Go" is basically reflecting the same behavior as of an "Enter" button on a normal browser & keyboard. You can achieve through below code:

if (event.keyCode == 13) {
           //Handling "Go" Button to move to next input field
       }

OR

If your input fields are more, then data-dependency will be best solution. If you want to prevent users from submitting the form, you can put required validations on the form using javascript, where you can specify data-dependency inside input field with required, which helps move cursor to a particular field which you specified in data-dependency.

<input type="text" id="first" data-dependency="second" />
<input type="text" id="second" data-dependency="third" />
<input type="text" id="third" />

It move focus to next fields in form until its your last field. Once last field reaches you can allow it to act as enter. So basically Go will keep moving focus to next fields until its your last field & then will submit the form.