PDA

View Full Version : NumberField with leading zeros



jurban
30 Jun 2015, 11:38 AM
I have a form with a numberfield where the user will enter a 6 digit code. The valid value are 1 - 999999 and the user must enter 6 digits. For example: 123456, 987600 or 000123. This last example is where I am having problems. When the user leaves the field after entering 000123 the numberfield automatically changes the value to 123 which is NOT valid for this field. How do I configure the numberfield to not remove the leading zeros? I know I could roll my own field starting wtih a textfield and handling the key events, but this should be something numberfield should support via a config option as leading zeros are valid numbers.

tristan.lee
30 Jun 2015, 1:39 PM
There's a user extension available that should solve what you're looking for: https://gist.github.com/gregawoods/5977728 This functionality isn't available within Ext.form.field.Number though.

pmp

jurban
1 Jul 2015, 6:15 AM
Thanks