Results 1 to 5 of 5

Thread: Numberfield with maskRe accepting '.' and '-' problem

  1. #1
    Sencha User
    Join Date
    Jun 2011
    Posts
    73
    Answers
    5
    Vote Rating
    2
      0  

    Default Answered: Numberfield with maskRe accepting '.' and '-' problem

    in extjs 3 ive used maskRe: /^[0-9]$/ to accept only numbers between 0-9, but on
    extjs 4 the '.' and '-' are now accepted too, how do i solve this only accepting
    0-9 numbers on a NumberField?

  2. Did you try using minValue & allowDecimals on your Ext.form.field.Number aka xtype='numberfield'? Sounds like you are working against the number field by using the mask it inherits from textfield.

    Careful with trailing commas if you paste this :

    minValue: 0,
    allowDecimals: false,

  3. #2
    Sencha Premium User
    Join Date
    Feb 2011
    Location
    NJ
    Posts
    337
    Answers
    62
    Vote Rating
    61
      0  

    Default

    Is this just a regular expression question? Are you looking for a regular expression for allowing 0-9, '.', and '-'? In that case it should be /[0-9\.\-]$/

  4. #3
    Sencha User
    Join Date
    Jun 2011
    Posts
    73
    Answers
    5
    Vote Rating
    2
      0  

    Default

    Only 0-9, but the chars '.' and '-' keep appearing

  5. #4
    Sencha User carol.ext's Avatar
    Join Date
    Jun 2007
    Location
    Littleton, Colorado, USA
    Posts
    708
    Answers
    25
    Vote Rating
    36
      0  

    Default

    Did you try using minValue & allowDecimals on your Ext.form.field.Number aka xtype='numberfield'? Sounds like you are working against the number field by using the mask it inherits from textfield.

    Careful with trailing commas if you paste this :

    minValue: 0,
    allowDecimals: false,

  6. #5
    Sencha User
    Join Date
    Jun 2011
    Posts
    73
    Answers
    5
    Vote Rating
    2
      0  

    Default

    Quote Originally Posted by carol.ext View Post
    Did you try using minValue & allowDecimals on your Ext.form.field.Number aka xtype='numberfield'? Sounds like you are working against the number field by using the mask it inherits from textfield.

    Careful with trailing commas if you paste this :
    This solve my problem. I didn't know that allowDecimals existed :/. Thank you very much!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •