Search code examples
sencha-touch-2phone-number

When using numberfield, the 0 value will be removed at the begin of the sequence


I have a numberfield like below

               {
                    xtype: 'numberfield',
                    name: 'phoneNumber',
                    label: 'Phonenumber',
                    required: false
                }

When a user inserts a value like 3832, it will be saved right but when the user sets a value with 0 at the begin of a sequence like 0123, the zero will be removed and only 123 will be saved.

In my case I want to store some phonenumbers which have a 0 value at the begin.

PS. the phoneNumber in the model is a string, so it will be saved as a string

{ name: 'phoneNumber', type: 'string' }

How could I resolve this?

Thanks in advance.


Solution

  • You should using a textfield and in controller to checking Ext.isNumeric(phoneNumberValue)