Subversion Repositories Applications.papyrus

Rev

Rev 1318 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1318 Rev 1422
1
/*
1
/*
2
	Copyright (c) 2004-2006, The Dojo Foundation
2
	Copyright (c) 2004-2006, The Dojo Foundation
3
	All Rights Reserved.
3
	All Rights Reserved.
4
 
4
 
5
	Licensed under the Academic Free License version 2.1 or above OR the
5
	Licensed under the Academic Free License version 2.1 or above OR the
6
	modified BSD license. For more information on Dojo licensing, see:
6
	modified BSD license. For more information on Dojo licensing, see:
7
 
7
 
8
		http://dojotoolkit.org/community/licensing.shtml
8
		http://dojotoolkit.org/community/licensing.shtml
9
*/
9
*/
-
 
10
 
-
 
11
 
10
 
12
 
11
dojo.provide("dojo.validate.us");
13
dojo.provide("dojo.validate.us");
12
dojo.require("dojo.validate.common");
14
dojo.require("dojo.validate.common");
13
dojo.validate.us.isCurrency = function (value, flags) {
15
dojo.validate.us.isCurrency = function (value, flags) {
14
	return dojo.validate.isCurrency(value, flags);
16
	return dojo.validate.isCurrency(value, flags);
15
};
17
};
16
dojo.validate.us.isState = function (value, flags) {
18
dojo.validate.us.isState = function (value, flags) {
17
	var re = new RegExp("^" + dojo.regexp.us.state(flags) + "$", "i");
19
	var re = new RegExp("^" + dojo.regexp.us.state(flags) + "$", "i");
18
	return re.test(value);
20
	return re.test(value);
19
};
21
};
20
dojo.validate.us.isPhoneNumber = function (value) {
22
dojo.validate.us.isPhoneNumber = function (value) {
21
	var flags = {format:["###-###-####", "(###) ###-####", "(###) ### ####", "###.###.####", "###/###-####", "### ### ####", "###-###-#### x#???", "(###) ###-#### x#???", "(###) ### #### x#???", "###.###.#### x#???", "###/###-#### x#???", "### ### #### x#???", "##########"]};
23
	var flags = {format:["###-###-####", "(###) ###-####", "(###) ### ####", "###.###.####", "###/###-####", "### ### ####", "###-###-#### x#???", "(###) ###-#### x#???", "(###) ### #### x#???", "###.###.#### x#???", "###/###-#### x#???", "### ### #### x#???", "##########"]};
22
	return dojo.validate.isNumberFormat(value, flags);
24
	return dojo.validate.isNumberFormat(value, flags);
23
};
25
};
24
dojo.validate.us.isSocialSecurityNumber = function (value) {
26
dojo.validate.us.isSocialSecurityNumber = function (value) {
25
	var flags = {format:["###-##-####", "### ## ####", "#########"]};
27
	var flags = {format:["###-##-####", "### ## ####", "#########"]};
26
	return dojo.validate.isNumberFormat(value, flags);
28
	return dojo.validate.isNumberFormat(value, flags);
27
};
29
};
28
dojo.validate.us.isZipCode = function (value) {
30
dojo.validate.us.isZipCode = function (value) {
29
	var flags = {format:["#####-####", "##### ####", "#########", "#####"]};
31
	var flags = {format:["#####-####", "##### ####", "#########", "#####"]};
30
	return dojo.validate.isNumberFormat(value, flags);
32
	return dojo.validate.isNumberFormat(value, flags);
31
};
33
};
32
 
34