Home > DeveloperSection > Forums > US Phone number validation in sencha touch
Jeet Verma
Jeet Verma

Total Post:110

Points:776
Posted on    June-11-2013 2:59 AM

 Sencha Touch Sencha Touch 
Ratings:


 1 Reply(s)
 1548  View(s)
Rate this:
Hi Developers,

I have created employee information form in sencha touch as following structure

Emp Id
Emp Name
Emp Address
Emp Email Id
Emp Mobile

My Problem is, I want to validate US Mobile number.
Please help.
Thanks in advance. 


Arun Singh

Total Post:68

Points:476
Posted on    August-06-2013 1:49 AM

Hi Jeet Verma,
Sencha Touch provides many type of validation such as Email, Exclusion, Format, Inclusion, Length and Presence Validation to validate your Form in appropriate manner. Now come to your question, To resolve this problem you can use Format Validation like as:
 
validations: [
                { type: 'format',   name: 'mobile', matcher: /^(\([0-9]{3}\) |[0-9]{3}-)[0-9]{3}-[0-9]{4}$/, message:"Wrong Format for Mobile Number"},
            ]
        });
I hope it might be resolve your problem!! 

Modified On Aug-06-2013 01:50:46 AM

Don't want to miss updates? Please click the below button!

Follow MindStick