Our client wants us to display numeric keyboard for an input field so basically I created a field like:
Yes, there is another way.
type="number"
but use type="text"
type="tel"'
for only Android or broken. (can't use on iPhone as no period then)type="text"
and then javascript with custom behavior. See: Period always shows: http://jsbin.com/heqeduyi/1/
Period shows once 3 digits: http://jsbin.com/yinaweho/1
To have decimal point in the numeric keyboard on Android Samsung devices use this in you EditText:
android:inputType="numberDecimal"
Did you try setting step to "any". Like:
<input type="number" name="quantity" step="any" />
I took out the "value" because I think you should, even if just for testing
I do this in C#/Xamarin and what works for me on the code side (I dynamically build up forms) is using the following:
EditText edittext1 = new EditText(view.Context);
edittext1.InputType = Android.Text.InputTypes.NumberFlagDecimal;
Hope it helps someone
A workaround is to use type="tel"
instead of type="number"
. Unfortunately on iOS type="tel"
doesn't display the ,
char on the keyboard (at least I didn't find it there). You can check the user agent for iOS devices and then change type
on "number"
.