diff options
Diffstat (limited to 'js/dojo-1.6/dojox/validate/ca.xd.js')
| -rw-r--r-- | js/dojo-1.6/dojox/validate/ca.xd.js | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/js/dojo-1.6/dojox/validate/ca.xd.js b/js/dojo-1.6/dojox/validate/ca.xd.js new file mode 100644 index 0000000..6eed300 --- /dev/null +++ b/js/dojo-1.6/dojox/validate/ca.xd.js @@ -0,0 +1,66 @@ +/*
+ Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
+ Available via Academic Free License >= 2.1 OR the modified BSD license.
+ see: http://dojotoolkit.org/license for details
+*/
+
+
+dojo._xdResourceLoaded(function(dojo, dijit, dojox){
+return {depends: [["provide", "dojox.validate.ca"],
+["require", "dojox.validate._base"]],
+defineResource: function(dojo, dijit, dojox){if(!dojo._hasResource["dojox.validate.ca"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
+dojo._hasResource["dojox.validate.ca"] = true;
+dojo.provide("dojox.validate.ca");
+/*=====
+
+ dojox.validate.ca = {
+ // summary: Module which includes Canadian-specific methods for dojox.validate
+ }
+
+=====*/
+dojo.require("dojox.validate._base");
+
+dojo.mixin(dojox.validate.ca,{
+
+ isPhoneNumber: function(/* String */value){
+ // summary: Validates Canadian 10-digit phone number for several common formats
+ return dojox.validate.us.isPhoneNumber(value); // Boolean
+ },
+
+ isProvince: function(/* String[2] */value) {
+ // summary: Validates Canadian province abbreviations (2 characters)
+ var re = new RegExp("^" + dojox.validate.regexp.ca.province() + "$", "i");
+ return re.test(value); // Boolean
+ },
+
+ isSocialInsuranceNumber: function(/* String */value) {
+ // summary: Validates Canadian 9 digit social insurance number for several
+ // common formats
+ //
+ // description:
+ // Validates Canadian 9 digit social insurance number for several
+ // common formats. This routine only pattern matches and does not
+ // use the Luhn Algorithm to validate number.
+ //
+ var flags = { format: [ "###-###-###", "### ### ###", "#########" ]};
+ return dojox.validate.isNumberFormat(value, flags); // Boolean
+ },
+
+ isPostalCode: function(value) {
+ // summary: Validates Canadian 6 digit postal code
+ //
+ // description:
+ // Validates Canadian 6 digit postal code.
+ // Canadian postal codes are in the format ANA NAN,
+ // where A is a letter and N is a digit, with a space
+ // separating the third and fourth characters.
+ //
+ var re = new RegExp("^" + dojox.validate.regexp.ca.postalCode() + "$", "i");
+ return re.test(value); // Boolean
+ }
+
+});
+
+}
+
+}};});
|
