10-30-2012 02:52 PM
TextFieldInputMode supports the following numeric input modes but none of them restrict input to just numbers.
PhoneNumber
NumbersAndPunctuation
NumericPassword
Pin
This has got to be an extremely common use-case. Is there a work around besides filtering input as it's typed?
10-30-2012 03:53 PM
10-30-2012 04:22 PM
That could easily be fixed by designing the options to be OR'able together like so:
TextFieldInputMode.Numeric | TextFieldInputMode.Punctionation
TextFieldInputMode.Numeric | TextFieldInputMode.Plus | TextFieldInputMode.Minus
TextFieldInputMode.Numeric | TextFieldInputMode.Decimal
TextFieldInputMode.Numeric | TextFieldInputMode.Password
03-08-2013 02:23 PM
I hve also tried the nummericandpunctuation and on the latest Z10 release using 1673 (10.0.9.), my app still accepts the full keyboard.
03-08-2013 02:37 PM
03-09-2013 09:46 AM
I did that using RegExp
Here is a JS function:
function numericOnly (textin) { // allow users to use numbers only
var m_strOut = new String (textin);
m_strOut = m_strOut.replace(/[^\d.]/g,'');
return m_strOut;
} // end numericOnly
and call once TextChanging signal is emitted:
onTextChanging: {
text = numericOnly(text)
}
That should work.