How to get Next button on android softkeyboard in place of Go Button in phonegap
Solution 1
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.
Solution 2
Its been said that if have input fields without or outside the form tag means you will get next button as tab button
As far as i know there is no proper solution to get next button instead of go . There are only workarounds do it. Most common one is to capture the 'Go' button as enter key(keycode '13') in javascript and do your thing.
$('selector').on("keydown",function(event){
if (event.keyCode == 9) {
//you got tab i.e "NEXT" Btn
}
if (event.keyCode == 13) {
//you got enter i.e "GO" Btn
}
});
for tab button instead of enter
There has been also sources that already discusses these GO Vs NEXT button
Related videos on Youtube
Deep Mehta
A highly motivated and creative Computer engineer seeking to gain knowledge and make a career in the field of application development. Personal website #SOreadytohelp
Updated on July 24, 2022Comments
-
Deep Mehta almost 2 years
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. is there any plugin for specifying that for android.
-
Siddharth_Vyas almost 10 yearsCheck this : stackoverflow.com/questions/23470439/…
-
Deep Mehta almost 10 years@SiddharthVyas i have already looked upon that question it did not answered what i needed. but thank you for helping.!
-
rousseauo almost 8 yearsAny update on this ? Am trying to change the Go to a Next button (with HTML/JS) for Android/any other mobile device. I know this is possible, I saw it on Stripe Checkout; here's the screenshot: pasteboard.co/1uyG9vOM.png
-
Deep Mehta almost 8 yearsStripe uses hybrid or native?
-
rousseauo almost 8 years@DeepMehta In that case it's a webpage. But I found how they did, you only have to use type="number" It will give you the next arrow, but probably not what you want. :( So back to the "it's currently not possible".
-
Deep Mehta almost 8 yearsDid you tested on Samsung device?
-
-
Deep Mehta almost 10 yearsI am asking for phonegap application.
-
Deep Mehta almost 10 yearsYea i have handle the events based on key code. But i can't really afford to use input fields outside form tag.
-
Sathya Raj almost 10 years@DeepMehta have you tried it? is Next button displaying ? ... It may be huge pay off to implement manually for form submit in javascript, but this wat you r asking for. As of now this is the only way to do it.
-
Deep Mehta almost 10 yearsSurly will try what you said.
-
Deep Mehta almost 10 yearsI did all manually coding all possibility. major issue was form submission on GO button press. then it was knowing which field to focus. took up lot of time. but still its not upto the mark.
-
rousseauo almost 8 yearsAny update on this ? Am trying to change the Go to a Next button (with HTML/JS) for Android/any other mobile device. I know this is possible, I saw it on Stripe Checkout; here's the screenshot: pasteboard.co/1uyG9vOM.png
-
Alexis Wilke about 7 yearsI have
tabindex
setup right and no "Next", just "Go" and that's with a Galaxy j7 (new early 2017.) -
Janning over 6 years"should be" is the important part in this answer ;-)