Input Type = Numeric Keypad Disabled on Galaxy Tab

I know that there are many questions that isssue already answered, but none of the solutions given worked for me.

I am developing a website for an enterprise using the Samsung Galaxy Tab. There are many inputs whose contents are decimal numbers. So I tried using <input type="number" /> . But the navigator displays a keyboard with a dot and a comma. Not only that, but onfocus, dot or comma delimiters are removed from the value.

I already tried to set such a step as "0.1", "0.01", "0.1", "0.01", "any", etc., tried to use min, max, pattern with regular an expression that matches decimal numbers ... There are no stackoverflow tips to try, and that's awful haha.

I use Samsung Galaxy Tab 10.1 with the default browser, but I did not find any document talking about any limitations of its html5 implementation. Therefore, at present I don’t know if there is something that I don’t see, if there is something that I can try, or if something knows that this is a Galaxy Tab error, so I can not do anything for of this.

Thank you very much in advance.

+7
source share
3 answers

In android namespace you can use:

  android:inputType="numberDecimal" 

Which allows you to enter "."

+4
source

You need to extend your webview class and use its object as follows

 public class WebViewExtended extends WebView{ public WebViewExtended(Context context) { super(context); } public WebViewExtended(Context context, AttributeSet attrs) { super(context, attrs); } public WebViewExtended(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } @Override public InputConnection onCreateInputConnection(EditorInfo outAttrs) { InputConnection connection = super.onCreateInputConnection(outAttrs); if ((outAttrs.inputType & InputType.TYPE_CLASS_NUMBER) == InputType.TYPE_CLASS_NUMBER) { outAttrs.inputType |= InputType.TYPE_NUMBER_FLAG_DECIMAL; } return connection; } } 
+4
source

The HTML5 specification for input with a number type states that any string that can be parsed as a valid floating point number . This includes . , as well as - , + and e .

Therefore, Samsung Galaxy Tab 10.1 implementation is not valid.

If you need to support this device, you may need to use type="text" and check the string. This will not automatically configure the correct keyboard on devices with soft keys.

 <input type="text" pattern="^-?(?:[0-9]+|[0-9]*\.[0-9]+)$" name="NumberInput"> 
+2
source

All Articles