Results 1 to 7 of 7

Thread: Limits to user input: maskRe and stripCharsRe

  1. #1
    Ext User
    Join Date
    Jan 2008
    Posts
    29
    Vote Rating
    1
      0  

    Default Limits to user input: maskRe and stripCharsRe

    I cannot understand, probably because i'm not a native english spoker, wich differences are beetween

    stripCharsRe : filter characters after being typed in, but before being validated

    and

    maskRe : filter out keystrokes before any validation occurs

    and ...

    if I want only to accept lowercase chars ... i must write a positive regex (include only what I write) or a negative regex (exclude only whay I write) ?

  2. #2
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    - maskRe determines the characters that you can type (e.g. maskRe: /[a-z]/ will only allow lower case characters).
    - stripCharsRe is used to strip out text before validation (e.g. stripCharsRe: /(^\s+|\s+$)/g will strip leading and trailing spaces).
    - regexp is used to validate the resulting value (e.g. regexp: /^[a-z]+$/ will only accept a string of lower case characters).

  3. #3
    Ext User
    Join Date
    Jan 2008
    Posts
    29
    Vote Rating
    1
      1  

    Default

    sorry,

    maskRe or stripCharRe make me unable to digit a key (it will be deleted after typed) ?

  4. #4
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    That is caused by your stripCharRe setting (to what did you set it?)

  5. #5
    Ext User
    Join Date
    Jan 2008
    Posts
    29
    Vote Rating
    1
      0  

    Default

    I was using /[A-Z]/i but I resolved using /[a-z]/

    So form accept only lowercase chars... So I now understand that maskRe is a positve filter: accept only what matches regexp. I cannot digit every key is not matched, it will not be displayed at all


    I tried using the same /[a-z]/ regexp using stripCharsRe and the behaviur is different: stripCharsRe is a negative filter: accept only what DOESN'T match to regexp. So I can digit a 'T' and it will be displayed, but if I digit a 't' it will be first displayed and then discarded, deleted, from text box.
    Last edited by realtebo2; 6 Sep 2009 at 1:08 AM. Reason: Added more info

  6. #6
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    But do you really want to set a stripCharsRe? Wouldn't it be better to only set maskRe and regexp?

  7. #7
    Ext User
    Join Date
    Jan 2008
    Posts
    29
    Vote Rating
    1
      0  

    Default

    no, no, I only wanted to understand differences beetween the 2 ways. So I used maskRe.

Posting Permissions

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