PDA

View Full Version : add new Validation type



paulr
9 Aug 2010, 1:36 AM
Hey guys,
i am a newbie in ExtJS. I tried to add a new validation type for phonenumber which allows user to enter
'+617231273' for example.

the regex that i used is ^\+?[0-9]+

i put the masking as the same. What i get is a textfield that allows user to only input numbers.

Please advice me how to solve this.

Thanks in advance

Condor
9 Aug 2010, 2:02 AM
Your maskRe should be /[+0-9]/ (it's used to filter the individual keys and not the value).

paulr
11 Aug 2010, 9:15 PM
Your maskRe should be /[+0-9]/ (it's used to filter the individual keys and not the value).

Thanks for that Condor!

I put that into the ext-all.js which i believe is a bad coding principle.
Could you direct me as to how to properly add a new validation type?

Cheers

Condor
11 Aug 2010, 11:00 PM
Have a look at the examples/form/adv-vtypes example in the SDK.