root / trunk / web / dojo / dojox / validate / us.js @ 9
History | View | Annotate | Download (1.13 KB)
1 | 9 | andrej.cim | /*
|
---|---|---|---|
2 | Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
|
||
3 | Available via Academic Free License >= 2.1 OR the modified BSD license.
|
||
4 | see: http://dojotoolkit.org/license for details
|
||
5 | */
|
||
6 | |||
7 | |||
8 | if(!dojo._hasResource["dojox.validate.us"]){ |
||
9 | dojo._hasResource["dojox.validate.us"]=true; |
||
10 | dojo.provide("dojox.validate.us");
|
||
11 | dojo.require("dojox.validate._base");
|
||
12 | dojox.validate.us.isState=function(_1,_2){ |
||
13 | var re=new RegExp("^"+dojox.validate.regexp.us.state(_2)+"$","i"); |
||
14 | return re.test(_1);
|
||
15 | }; |
||
16 | dojox.validate.us.isPhoneNumber=function(_3){ |
||
17 | var _4={format:["###-###-####","(###) ###-####","(###) ### ####","###.###.####","###/###-####","### ### ####","###-###-#### x#???","(###) ###-#### x#???","(###) ### #### x#???","###.###.#### x#???","###/###-#### x#???","### ### #### x#???","##########"]}; |
||
18 | return dojox.validate.isNumberFormat(_3,_4);
|
||
19 | }; |
||
20 | dojox.validate.us.isSocialSecurityNumber=function(_5){ |
||
21 | var _6={format:["###-##-####","### ## ####","#########"]}; |
||
22 | return dojox.validate.isNumberFormat(_5,_6);
|
||
23 | }; |
||
24 | dojox.validate.us.isZipCode=function(_7){ |
||
25 | var _8={format:["#####-####","##### ####","#########","#####"]}; |
||
26 | return dojox.validate.isNumberFormat(_7,_8);
|
||
27 | }; |
||
28 | } |