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
maskRe : filter out keystrokes before any validation occurs
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) ?
- 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).
maskRe or stripCharRe make me unable to digit a key (it will be deleted after typed) ?
That is caused by your stripCharRe setting (to what did you set it?)
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
But do you really want to set a stripCharsRe? Wouldn't it be better to only set maskRe and regexp?
no, no, I only wanted to understand differences beetween the 2 ways. So I used maskRe.