1306 |
daniel |
1 |
|
|
|
2 |
(function($){
|
|
|
3 |
$.fn.validationEngineLanguage = function(){
|
|
|
4 |
};
|
|
|
5 |
$.validationEngineLanguage = {
|
|
|
6 |
newLang: function(){
|
|
|
7 |
$.validationEngineLanguage.allRules = {
|
|
|
8 |
"required": { // Add your regex rules here, you can take telephone as an example
|
|
|
9 |
"regex": "none",
|
3573 |
daniel |
10 |
"alertText": wpsg_trans_v1.required_alertText,
|
|
|
11 |
"alertTextCheckboxMultiple": wpsg_trans_v1.required_alertTextCheckboxMultiple,
|
|
|
12 |
"alertTextCheckboxe": wpsg_trans_v1.required_alertTextCheckboxe
|
1306 |
daniel |
13 |
},
|
|
|
14 |
"minSize": {
|
|
|
15 |
"regex": "none",
|
3573 |
daniel |
16 |
"alertText": wpsg_trans_v1.minSize_alertText,
|
|
|
17 |
"alertText2": wpsg_trans_v1.minSize_alertText2
|
1306 |
daniel |
18 |
},
|
|
|
19 |
"maxSize": {
|
|
|
20 |
"regex": "none",
|
3573 |
daniel |
21 |
"alertText": wpsg_trans_v1.maxSize_alertText,
|
|
|
22 |
"alertText2": wpsg_trans_v1.maxSize_alertText
|
1306 |
daniel |
23 |
},
|
|
|
24 |
"groupRequired": {
|
|
|
25 |
"regex": "none",
|
3573 |
daniel |
26 |
"alertText": wpsg_trans_v1.groupRequired_alertText
|
1306 |
daniel |
27 |
},
|
|
|
28 |
"min": {
|
|
|
29 |
"regex": "none",
|
3573 |
daniel |
30 |
"alertText": wpsg_trans_v1.min_alertText
|
1306 |
daniel |
31 |
},
|
|
|
32 |
"max": {
|
|
|
33 |
"regex": "none",
|
3573 |
daniel |
34 |
"alertText": wpsg_trans_v1.max_alertText
|
1306 |
daniel |
35 |
},
|
|
|
36 |
"past": {
|
|
|
37 |
"regex": "none",
|
3573 |
daniel |
38 |
"alertText": wpsg_trans_v1.past_alertText
|
1306 |
daniel |
39 |
},
|
|
|
40 |
"future": {
|
|
|
41 |
"regex": "none",
|
3573 |
daniel |
42 |
"alertText": wpsg_trans_v1.future_alertText
|
1306 |
daniel |
43 |
},
|
|
|
44 |
"maxCheckbox": {
|
|
|
45 |
"regex": "none",
|
3573 |
daniel |
46 |
"alertText": wpsg_trans_v1.maxCheckbox_alertText
|
1306 |
daniel |
47 |
},
|
|
|
48 |
"minCheckbox": {
|
|
|
49 |
"regex": "none",
|
3573 |
daniel |
50 |
"alertText": wpsg_trans_v1.minCheckbox_alertText,
|
|
|
51 |
"alertText2": wpsg_trans_v1.minCheckbox_alertText2
|
1306 |
daniel |
52 |
},
|
|
|
53 |
"equals": {
|
|
|
54 |
"regex": "none",
|
3573 |
daniel |
55 |
"alertText": wpsg_trans_v1.equals_alertText
|
1306 |
daniel |
56 |
},
|
|
|
57 |
"creditCard": {
|
|
|
58 |
"regex": "none",
|
3573 |
daniel |
59 |
"alertText": wpsg_trans_v1.creditCard_alertText
|
1306 |
daniel |
60 |
},
|
|
|
61 |
"phone": {
|
|
|
62 |
// credit: jquery.h5validate.js / orefalo
|
|
|
63 |
"regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{1,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
|
3573 |
daniel |
64 |
"alertText": wpsg_trans_v1.phone_alertText
|
1306 |
daniel |
65 |
},
|
|
|
66 |
"email": {
|
|
|
67 |
// Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/
|
|
|
68 |
"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,
|
3573 |
daniel |
69 |
"alertText": wpsg_trans_v1.email_alertText
|
1306 |
daniel |
70 |
},
|
|
|
71 |
"integer": {
|
|
|
72 |
"regex": /^[\-\+]?\d+$/,
|
3573 |
daniel |
73 |
"alertText": wpsg_trans_v1.integer_alertText
|
1306 |
daniel |
74 |
},
|
|
|
75 |
"number": {
|
|
|
76 |
// Number, including positive, negative, and floating decimal. credit: orefalo
|
|
|
77 |
"regex": /^[\-\+]?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/,
|
3573 |
daniel |
78 |
"alertText": wpsg_trans_v1.number_alertText
|
1306 |
daniel |
79 |
},
|
|
|
80 |
"date": {
|
|
|
81 |
// Date in ISO format. Credit: bassistance
|
|
|
82 |
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/,
|
3573 |
daniel |
83 |
"alertText": wpsg_trans_v1.date_alertText
|
1306 |
daniel |
84 |
},
|
|
|
85 |
"ipv4": {
|
|
|
86 |
"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]))$/,
|
3573 |
daniel |
87 |
"alertText": wpsg_trans_v1.ipv4_alertText
|
1306 |
daniel |
88 |
},
|
|
|
89 |
"url": {
|
|
|
90 |
"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,
|
3573 |
daniel |
91 |
"alertText": wpsg_trans_v1.url_alertText
|
1306 |
daniel |
92 |
},
|
|
|
93 |
"onlyLetterSp": {
|
|
|
94 |
"regex": /^[a-zA-ZäüöÄÜÖßs\ \\\']+$/,
|
3573 |
daniel |
95 |
"alertText": wpsg_trans_v1.onlyLetterSp_alertText
|
1306 |
daniel |
96 |
},
|
|
|
97 |
"onlyLetterNumber": {
|
|
|
98 |
"regex": /^[0-9a-zA-ZäüöÄÜÖßs-]+$/,
|
3573 |
daniel |
99 |
"alertText": wpsg_trans_v1.onlyLetterNumber_alertText
|
|
|
100 |
},
|
1306 |
daniel |
101 |
// --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings
|
|
|
102 |
"ajaxUserCall": {
|
|
|
103 |
"url": "ajaxValidateFieldUser",
|
|
|
104 |
// you may want to pass extra data on the ajax call
|
|
|
105 |
"extraData": "name=eric",
|
3573 |
daniel |
106 |
"alertText": wpsg_trans_v1.ajaxUserCall_alertText,
|
|
|
107 |
"alertTextLoad": wpsg_trans_v1.ajaxUserCall_alertTextLoad
|
1306 |
daniel |
108 |
},
|
|
|
109 |
"ajaxNameCall": {
|
|
|
110 |
// remote json service location
|
|
|
111 |
"url": "ajaxValidateFieldName",
|
|
|
112 |
// error
|
3573 |
daniel |
113 |
"alertText": wpsg_trans_v1.ajaxNameCall_alertText,
|
1306 |
daniel |
114 |
// if you provide an "alertTextOk", it will show as a green prompt when the field validates
|
3573 |
daniel |
115 |
"alertTextOk": wpsg_trans_v1.ajaxNameCall_alertTextOk,
|
1306 |
daniel |
116 |
// speaks by itself
|
3573 |
daniel |
117 |
"alertTextLoad": wpsg_trans_v1.ajaxNameCall_alertTextLoad
|
1306 |
daniel |
118 |
},
|
|
|
119 |
"validate2fields": {
|
3573 |
daniel |
120 |
"alertText": wpsg_trans_v1.validate2fields_alertText
|
1306 |
daniel |
121 |
},
|
|
|
122 |
"vname": {
|
|
|
123 |
"regex": "none",
|
3573 |
daniel |
124 |
"alertText": wpsg_trans_v1.vname_alertText
|
1306 |
daniel |
125 |
}
|
|
|
126 |
};
|
|
|
127 |
|
|
|
128 |
}
|
|
|
129 |
};
|
|
|
130 |
$.validationEngineLanguage.newLang();
|
|
|
131 |
})(jQuery);
|