]> Dogcows Code - chaz/chatty/blob - root/static/js/jquery.validationEngine-en.js
2a2b70f3a09c4cd609dcb7730423c78bbb344d7e
[chaz/chatty] / root / static / js / jquery.validationEngine-en.js
1 (function($){
2 $.fn.validationEngineLanguage = function(){
3 };
4 $.validationEngineLanguage = {
5 newLang: function(){
6 $.validationEngineLanguage.allRules = {
7 "required": { // Add your regex rules here, you can take telephone as an example
8 "regex": "none",
9 "alertText": "* This field is required",
10 "alertTextCheckboxMultiple": "* Please select an option",
11 "alertTextCheckboxe": "* This checkbox is required",
12 "alertTextDateRange": "* Both date range fields are required"
13 },
14 "dateRange": {
15 "regex": "none",
16 "alertText": "* Invalid ",
17 "alertText2": "Date Range"
18 },
19 "dateTimeRange": {
20 "regex": "none",
21 "alertText": "* Invalid ",
22 "alertText2": "Date Time Range"
23 },
24 "minSize": {
25 "regex": "none",
26 "alertText": "* Minimum ",
27 "alertText2": " characters allowed"
28 },
29 "maxSize": {
30 "regex": "none",
31 "alertText": "* Maximum ",
32 "alertText2": " characters allowed"
33 },
34 "groupRequired": {
35 "regex": "none",
36 "alertText": "* You must fill one of the following fields"
37 },
38 "min": {
39 "regex": "none",
40 "alertText": "* Minimum value is "
41 },
42 "max": {
43 "regex": "none",
44 "alertText": "* Maximum value is "
45 },
46 "past": {
47 "regex": "none",
48 "alertText": "* Date prior to "
49 },
50 "future": {
51 "regex": "none",
52 "alertText": "* Date past "
53 },
54 "maxCheckbox": {
55 "regex": "none",
56 "alertText": "* Maximum ",
57 "alertText2": " options allowed"
58 },
59 "minCheckbox": {
60 "regex": "none",
61 "alertText": "* Please select ",
62 "alertText2": " options"
63 },
64 "equals": {
65 "regex": "none",
66 "alertText": "* Fields do not match"
67 },
68 "phone": {
69 // credit: jquery.h5validate.js / orefalo
70 "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
71 "alertText": "* Invalid phone number"
72 },
73 "email": {
74 // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/
75 "regex": /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i,
76 "alertText": "* Invalid email address"
77 },
78 "integer": {
79 "regex": /^[\-\+]?\d+$/,
80 "alertText": "* Not a valid integer"
81 },
82 "number": {
83 // Number, including positive, negative, and floating decimal. credit: orefalo
84 "regex": /^[\-\+]?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/,
85 "alertText": "* Invalid floating decimal number"
86 },
87 "date": {
88 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/,
89 "alertText": "* Invalid date, must be in YYYY-MM-DD format"
90 },
91 "ipv4": {
92 "regex": /^((([01]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))[.]){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))$/,
93 "alertText": "* Invalid IP address"
94 },
95 "url": {
96 "regex": /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,
97 "alertText": "* Invalid URL"
98 },
99 "onlyNumberSp": {
100 "regex": /^[0-9\ ]+$/,
101 "alertText": "* Numbers only"
102 },
103 "onlyLetterSp": {
104 "regex": /^[a-zA-Z\ \']+$/,
105 "alertText": "* Letters only"
106 },
107 "onlyLetterNumber": {
108 "regex": /^[0-9a-zA-Z]+$/,
109 "alertText": "* No special characters allowed"
110 },
111 // --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings
112 "ajaxUserCall": {
113 "url": "ajaxValidateFieldUser",
114 // you may want to pass extra data on the ajax call
115 "extraData": "name=eric",
116 "alertText": "* This user is already taken",
117 "alertTextLoad": "* Validating, please wait"
118 },
119 "ajaxUserCallPhp": {
120 "url": "phpajax/ajaxValidateFieldUser.php",
121 // you may want to pass extra data on the ajax call
122 "extraData": "name=eric",
123 // if you provide an "alertTextOk", it will show as a green prompt when the field validates
124 "alertTextOk": "* This username is available",
125 "alertText": "* This user is already taken",
126 "alertTextLoad": "* Validating, please wait"
127 },
128 "ajaxNameCall": {
129 // remote json service location
130 "url": "ajaxValidateFieldName",
131 // error
132 "alertText": "* This name is already taken",
133 // if you provide an "alertTextOk", it will show as a green prompt when the field validates
134 "alertTextOk": "* This name is available",
135 // speaks by itself
136 "alertTextLoad": "* Validating, please wait"
137 },
138 "ajaxNameCallPhp": {
139 // remote json service location
140 "url": "phpajax/ajaxValidateFieldName.php",
141 // error
142 "alertText": "* This name is already taken",
143 // speaks by itself
144 "alertTextLoad": "* Validating, please wait"
145 },
146 "validate2fields": {
147 "alertText": "* Please input HELLO"
148 },
149 //tls warning:homegrown not fielded
150 "dateFormat":{
151 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(?:(?:0?[1-9]|1[0-2])(\/|-)(?:0?[1-9]|1\d|2[0-8]))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^(0?2(\/|-)29)(\/|-)(?:(?:0[48]00|[13579][26]00|[2468][048]00)|(?:\d\d)?(?:0[48]|[2468][048]|[13579][26]))$/,
152 "alertText": "* Invalid Date"
153 },
154 //tls warning:homegrown not fielded
155 "dateTimeFormat": {
156 "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1}$|^(?:(?:(?:0?[13578]|1[02])(\/|-)31)|(?:(?:0?[1,3-9]|1[0-2])(\/|-)(?:29|30)))(\/|-)(?:[1-9]\d\d\d|\d[1-9]\d\d|\d\d[1-9]\d|\d\d\d[1-9])$|^((1[012]|0?[1-9]){1}\/(0?[1-9]|[12][0-9]|3[01]){1}\/\d{2,4}\s+(1[012]|0?[1-9]){1}:(0?[1-5]|[0-6][0-9]){1}:(0?[0-6]|[0-6][0-9]){1}\s+(am|pm|AM|PM){1})$/,
157 "alertText": "* Invalid Date or Date Format",
158 "alertText2": "Expected Format: ",
159 "alertText3": "mm/dd/yyyy hh:mm:ss AM|PM or ",
160 "alertText4": "yyyy-mm-dd hh:mm:ss AM|PM"
161 }
162 };
163
164 }
165 };
166 $.validationEngineLanguage.newLang();
167 })(jQuery);
This page took 0.042893 seconds and 3 git commands to generate.