Skip to content

Commit 1dd10ca

Browse files
committed
Merge pull request posabsolute#671 from metalot/patch-1
Create jquery.validationEngine-lt.js
2 parents da47d60 + f02f5c1 commit 1dd10ca

File tree

1 file changed

+166
-0
lines changed

1 file changed

+166
-0
lines changed
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
(function($) {
2+
$.fn.validationEngineLanguage = function() {
3+
};
4+
$.validationEngineLanguage = {
5+
newLang : function() {
6+
$.validationEngineLanguage.allRules = {
7+
8+
// global messages
9+
"required" : { // Add your regex rules here, you can take
10+
// telephone as an example
11+
"regex" : "none",
12+
"alertText" : "* Privalomas laukas",
13+
"alertTextCheckboxMultiple" : "* Pasirinkite reikšmę",
14+
"alertTextCheckboxe" : "* Pasirinkite reikšmę",
15+
"alertTextDateRange" : "* Pasirinkite reikšmę"
16+
},
17+
"requiredInFunction" : {
18+
"func" : function(field, rules, i, options) {
19+
return (field.val() == "test") ? true : false;
20+
},
21+
"alertText" : "* Laukas turi būti lygus test laukui"
22+
},
23+
"dateRange" : {
24+
"regex" : "none",
25+
"alertText" : "* Neteisinga reikšmė ",
26+
"alertText2" : "Datos intervalas"
27+
},
28+
"dateTimeRange" : {
29+
"regex" : "none",
30+
"alertText" : "* Neteisinga reikšmė ",
31+
"alertText2" : "Datos ir laiko intervalas"
32+
},
33+
"minSize" : {
34+
"regex" : "none",
35+
"alertText" : "* Ne mažiau ",
36+
"alertText2" : " simbolių"
37+
},
38+
"maxSize" : {
39+
"regex" : "none",
40+
"alertText" : "* Ne daugiau ",
41+
"alertText2" : " simbolių"
42+
},
43+
"groupRequired" : {
44+
"regex" : "none",
45+
"alertText" : "* Užpildykite šiuos laukus "
46+
},
47+
"min" : {
48+
"regex" : "none",
49+
"alertText" : "* Mažiausia galima reikšmė: "
50+
},
51+
"max" : {
52+
"regex" : "none",
53+
"alertText" : "* Didžiausia galima reikšmė: "
54+
},
55+
"past" : {
56+
"regex" : "none",
57+
"alertText" : "* Data iki "
58+
},
59+
"future" : {
60+
"regex" : "none",
61+
"alertText" : "* Data po "
62+
},
63+
"maxCheckbox" : {
64+
"regex" : "none",
65+
"alertText" : "* Daugiausiai ",
66+
"alertText2" : " leidžiama pasirinkti"
67+
},
68+
"minCheckbox" : {
69+
"regex" : "none",
70+
"alertText" : "* Pasirinkite ",
71+
"alertText2" : " laukus"
72+
},
73+
"equals" : {
74+
"regex" : "none",
75+
"alertText" : "* Laukai nesutampa"
76+
},
77+
"creditCard" : {
78+
"regex" : "none",
79+
"alertText" : "* Neteisingi kreditinės kortelės duomenys"
80+
},
81+
"phone" : {
82+
// credit: jquery.h5validate.js / orefalo
83+
"regex" : /^([\+][0-9]{1,3}[\ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9\ \.\-\/]{3,20})((x|ext|extension)[\ ]?[0-9]{1,4})?$/,
84+
"alertText" : "* Invalid phone number"
85+
},
86+
"email" : {
87+
// HTML5 compatible email regex (
88+
// http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#
89+
// e-mail-state-%28type=email%29 )
90+
"regex" : /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
91+
"alertText" : "* Neteisingas el. pašto adresas"
92+
},
93+
"integer" : {
94+
"regex" : /^[\-\+]?\d+$/,
95+
"alertText" : "* Neteisingai įvestas skaičius"
96+
},
97+
"number" : {
98+
// Number, including positive, negative, and floating
99+
// decimal. credit: orefalo
100+
"regex" : /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.]([0-9]+))?$/,
101+
"alertText" : "* Neteisingai įvestas skaičius"
102+
},
103+
"date" : {
104+
// Check if date is valid by leap year
105+
"func" : function(field) {
106+
var pattern = new RegExp(
107+
/^(\d{4})[\/\-\.](0?[1-9]|1[012])[\/\-\.](0?[1-9]|[12][0-9]|3[01])$/);
108+
var match = pattern.exec(field.val());
109+
if (match == null)
110+
return false;
111+
112+
var year = match[1];
113+
var month = match[2] * 1;
114+
var day = match[3] * 1;
115+
var date = new Date(year, month - 1, day); // because
116+
// months
117+
// starts
118+
// from 0.
119+
120+
return (date.getFullYear() == year
121+
&& date.getMonth() == (month - 1) && date
122+
.getDate() == day);
123+
},
124+
"alertText" : "* Datos formatas: YYYY-MM-DD"
125+
},
126+
"ipv4" : {
127+
"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]))$/,
128+
"alertText" : "* Neteisingas IP adresas"
129+
},
130+
"url" : {
131+
"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,
132+
"alertText" : "* Neteisinga nuoroda"
133+
},
134+
"onlyNumberSp" : {
135+
"regex" : /^[0-9\ ]+$/,
136+
"alertText" : "* Tik skaičiai"
137+
},
138+
"onlyLetterSp" : {
139+
"regex" : /^[a-zA-Z\ \']+$/,
140+
"alertText" : "* Tik raidės"
141+
},
142+
"onlyLetterNumber" : {
143+
"regex" : /^[0-9a-zA-Z]+$/,
144+
"alertText" : "* Specialūs simboliai neleidžiami"
145+
},
146+
// tls warning:homegrown not fielded
147+
"dateFormat" : {
148+
"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]))$/,
149+
"alertText" : "* Neteisinga data"
150+
},
151+
// tls warning:homegrown not fielded
152+
"dateTimeFormat" : {
153+
"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})$/,
154+
"alertText" : "* Neteisingai įvesta data ar laikas",
155+
"alertText2" : "Teisingas formatas: ",
156+
"alertText3" : "mm/dd/yyyy hh:mm:ss AM|PM or ",
157+
"alertText4" : "yyyy-mm-dd hh:mm:ss AM|PM"
158+
}
159+
};
160+
161+
}
162+
};
163+
164+
$.validationEngineLanguage.newLang();
165+
166+
})(jQuery);

0 commit comments

Comments
 (0)