I'm using jquerymobile, but can't get the keypad to only show numeric keys (including decimals). Only default keypad is shown.I'm using phonegap,
I use
<input type="number">
the problem is that the numpad is shown but when i use
input {-webkit-user-modify: read-write-plaintext-only;}
the default keypad is only shown.
Any suggestion would be great.
Thankx.
use $('#<element-id>').focus();
Related
Currently I am using WebView in my application to load WebPage. WebView has one TextBox which only allows Numeric value to enter.
I have done JavaScript validation and restrict user to enter any other character other than Number.
It is working in WebPage but when TextBox is focused in Android WebView then It is not showing Numeric Keyboard.
Instead of that it is showing Simple Keyboard
What can be done to show Numeric Keyboard?
Finally I have solved it by specifying
<input type="number" />
instead of
<input type="text" />
in Web-form.
You need to set appropriate input type attribute:
http://www.w3schools.com/tags/att_input_type.asp
I'm using the following code in my project and it's working fine:
"How to show and hide soft keyboard in Android"
However, I would like to replace the keyboard with the "number" keyboard. I don't want it globally, so I'm guessing I won't have to edit the xml file. It should only be numeric when I call it from the javascript.
You can get any kind of Keyboard when you tap an input depending on its type
For a numeric keyboard, you need to set its type to number
<input type="number" name="txtNumber"/>
The Tel type brings in a Numerical keyboard like in dial mode.
<input type="tel" name="txtNumber"/>"
only put type "tel" works for me in Cordova.
<input class="textbox-container" type="tel" name="identification" id="identification">
iPhone's Mobile Safari seems to recognize most new HTML5 input types, in particular the ones detailed here, such that tapping in an input declared like so:
<input type="number" id="myInput" value=""/>
presents the iPhone's numeric keypad.
However, in the Android browser, the usual text keypad is shown when tapping the same input.
Is there a workaround for the Android browser or an alternative attribute that can be set or even a library I can include to have the android browser respect this setting?
if you specify on the input element the type as "number" it will automatically open with the numeric keypad
example
<input type="number" pattern="[0-9]*" name="amount_zip" value="loading.."></input>
the pattern attribute is for iPhone,
you can also get more info on inputs here
I just tried <input type="number"> with a Xoom (Honecomb, I think) and it does cause the numeric keypad to open, which is great, but the field only appears to allow positive integers. Hitting the '-' and '.' keys on the keypad have no effect. Adding relevant min / max attributes or setting a proper pattern don't seem to have any effect. In other words, if you want the keyboard to appear and your numeric field only needs to be zero or a positive integer, this will work. Otherwise (floats, negative numbers), you'll have to use text.
(I realize I'm not answering the question here, I would like to have left this as a comment for the previous answer, but can't figure out how)
I have designed a web app and it has a form which has one field below like,
phone:<input type="text">
When I touch this screen (selecting the textbox to enter the data), the qwerty keypad is enabled by default. It is with character after pressing shift I can enter numbers in the text field.
ex:
<select name="source" data-native-menu="true">
and
<select name="source">
The above example shows a lot of variation while selecting the options in Android mobile which I observed.
In the meantime, I am going to guess. Do you want to restrict the input to numbers? Does this help you?:
<input type="number" min="0" max="10">
(you can choose whatever min and max values you want or use only input="number")
That should force android to open the numeric keyboard instead of the full qwerty upon gaining focus.
I am developing an android application where we are using WebView to display Web page being served from Web Server. Everything is working fine except with the problem that when i am using the soft keyboard and switched to numeric key entry and move from first field to next field, the keyboard layout automatically changed to alphanumeric.
Is there any way using which i can pull up virtual keyboard in numeric mode only when i need to enter numbers only?
Thanks and Regards.
editTextField.setRawInputType(Configuration.KEYBOARD_QWERTY);
This shows the normal key pad with the numeric version first, yet allows you to switch between them.
getInput.setRawInputType(Configuration.KEYBOARD_12KEY);
This shows numeric only, with no option to enter text values.
I ran into a similar situation. I wanted numeric values only, but I have a "hint" that was text. Setting the inputType to number would not allow the hint to be displayed. This works around it fine.
Configuration.KEYBOARD_12KEY or Configuration.KEYBOARD_QWERTY is wrong way.
You have to use InputType (show doc here) on the EditText setRawInputType().
If you are talking about HTML, you could use HTML5 features, for example:
Number: <input type="number" name="points" min="1" max="10" />
Have tested this in HTC Desire browser, and it brings up different (numeric) keyboard when you enter data into such field.
Is there any way using which i can
pull up virtual keyboard in numeric
mode only when i need to enter numbers
only?
Yes, you can specify android:inputType XML attribute with the number or numberDecimal value:
<EditText
android:text=""
android:id="#+id/editTextNumber"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal">
</EditText>
Enjoy!!