Connect with me

Latest Tweets

ExtJS Phone Number Validation

Posted on by admin


Validate Phone Number With regex

Extjs has give us vtype for phone number validation but with this all the requirements are not full-filled …. we may need different type of phone number validation then the default vtype provided by Extjs What ?????? to do in this case…. !!!
Well don’t panic, we have other options to do this too … we can use regex to meet our desire validation….

Let’s Get Started then
1) don’t use numberfield rather you textfield
2) use regex for phone validation

Syntax :
regex: /^[(+{1})|(00{1})|(1425{1})|(1445{1})]+([0-9]){7,10}$/,

if you use this regex it only validated the phone no if :
-> it starts with + OR
-> it starts with 00 OR
-> it starts with 1425 OR
-> it starts with 1445

if you only want to validate with + and 00 then just remove |(1425{1})|(1445{1})
Now your regex will look like this:
Syntax :
regex: /^[(+{1})|(00{1})]+([0-9]){7,10}$/,

regex is very useful … Happy Coding ExtJS

Cheers

Share
[del.icio.us] [Digg] [dzone] [Facebook] [Friendsite] [Google] [LinkedIn] [MySpace] [Twitter] [Windows Live] [Yahoo!] [Email]

      


Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>


What is difference between managed and backing beans?

Although general convention is to use one Managed beans per JSF page/fragment, but managed beans can be used with multiple pages.  But Backing Bean can be only used for single page/fragment. Normally, Managed Bean is desired to have Pageflow scope, … Continue reading