user930141
user930141

Reputation: 81

Why does Android webview show "Next" in keyboard only if type="number" and not with type="text"?

I have a form with a few input fields. So I want to navigate between the fields with the next button but that just works when the input field type is "number". With type="text" it doesn't!

Is this a bug in Android 3.2.1?

My input fields are like that:

<input type="text" name="..." .... /> --> keyboard "Go"
<input type="text" name="..." .... /> --> keyboard "Go"
<input type="number" name="..." .... /> --> here it shows the "Next" button on the keyboard
<input type="text" name="..." .... /> --> keyboard "Go"

Upvotes: 8

Views: 3696

Answers (3)

Jon
Jon

Reputation: 101

DennisA is right for Android 4.0 and below.

In short this is not a bug but sadly how google implemented it (I would prefer a consistent GO for all those keys so you can prevent the default action in JavaScript).

With Android 4.1 (JellyBean), you can change the default behavior by extending WebViewInputConnection: https://github.com/android/platform_frameworks_base/blob/master/core/java/android/webkit/WebViewClassic.java#L379

(hackery involved)

Upvotes: 2

DennisA
DennisA

Reputation: 165

When webkit renders those input fields, it converts them into a class called android.webkit.WebTextView which determines how the softkeyboard would look like and there doesn't seem to be any good way to override the ImeOptions set by the WebTextView class

Upvotes: 0

njzk2
njzk2

Reputation: 39403

I suppose you need to specify that your input is not a multiline input, otherwise, the next is replaced by next

Upvotes: 0

Related Questions