Results 1 to 2 of 2

Thread: User can able to input only one '.' and '%'

  1. #1
    Sencha Premium Member
    Join Date
    Jun 2010

    Default User can able to input only one '.' and '%'


    I want restrict user only able to input one '.' and '%' in the textfield.
    like "22.1%" not "2.2.1%"
    If he input second '.', value should revert back to original value

    How to do this

  2. #2
    Sencha User
    Join Date
    Oct 2009
    Cambridge, UK


    You could do this with a custom validator function, specified as the validator config option (or to be more reusable, with vtype) of a TextField. However, if the user is always expected to type a percent symbol, I wonder if it would be a better design to simply use a NumberField (which means you get the validation it is a valid number for free) and just stick a '%' in a label to the right.

Posting Permissions

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