You are on page 1of 4

$.fn.

validationEngineLanguage = function(){
};
$.validationEngineLanguage = {
newLang: function(){
$.validationEngineLanguage.allRules = {
"required": { // Add your regex rules here, you can take telephone a
s an example
"regex": "none",
"alertText": "* Tru?ng ny b?t bu?c",
"alertTextCheckboxMultiple": "* Vui lng ch?n m?t ty ch?n",
"alertTextCheckboxe": "* Checkbox ny b?t bu?c",
"alertTextDateRange": "* C? hai tru?ng ngy thng d?u b?t bu?c"
},
"requiredInFunction": {
"func": function(field, rules, i, options){
return (field.val() == "test") ? true : false;
},
"alertText": "* Gi tr? c?a tru?ng ph?i l test"
},
"dateRange": {
"regex": "none",
"alertText": "* Khng dng ",
"alertText2": "Kho?ng ngy thng"
},
"dateTimeRange": {
"regex": "none",
"alertText": "* Khng dng ",
"alertText2": "Kho?ng th?i gian"
},
"minSize": {
"regex": "none",
"alertText": "* T?i thi?u ",
"alertText2": " s? k t? du?c cho php"
},
"maxSize": {
"regex": "none",
"alertText": "* T?i da ",
"alertText2": " s? k t? du?c cho php"
},
"groupRequired": {
"regex": "none",
"alertText": "* B?n ph?i di?n m?t trong nh?ng tru?ng sau"
},
"min": {
"regex": "none",
"alertText": "* Gi tr? nh? nh?t l "
},
"max": {
"regex": "none",
"alertText": "* Gi tr? l?n nh?t l "
},
"past": {
"regex": "none",
"alertText": "* Ngy ko di t?i "
},
"future": {
"regex": "none",
"alertText": "* Ngy d qua "
},
"maxCheckbox": {

"regex": "none",
"alertText": "* T?i da ",
"alertText2": " s? ty ch?n du?c cho php"
},
"minCheckbox": {
"regex": "none",
"alertText": "* Vui lng ch?n ",
"alertText2": " cc ty ch?n"
},
"equals": {
"regex": "none",
"alertText": "* Gi tr? cc tru?ng khng gi?ng nhau"
},
"creditCard": {
"regex": "none",
"alertText": "* S? th? tn d?ng sai"
},
"phone": {
// credit: jquery.h5validate.js / orefalo
"regex": /^([\+][0-9]{1,3}[\ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([09\ \.\-\/]{3,20})((x|ext|extension)[\ ]?[0-9]{1,4})?$/,
"alertText": "* S? di?n tho?i sai"
},
"email": {
// HTML5 compatible email regex ( http://www.whatwg.org/pecs/web
-apps/current-work/multipage/states-of-the-type-attribute.html#
e-mail-state%28type=email%29 )
"regex": /^[a-zA-Z0-9.!#$%&'*+/=?^_%x{|}~-]+@[a-zA-Z0-9-]+(?:\.[
a-zA-Z0-9-]+)*$/,
"alertText": "* ?a ch? thu di?n t? sai"
},
"integer": {
"regex": /^[\-\+]?\d+$/,
"alertText": "* Khng dng l s? nguyn"
},
"number": {
// Number, including positive, negative, and floating decimal. c
redit: orefalo
"regex": /^[\-\+]?((([0-9]{1,3})([,][0-9]{3})*)|([0-9]+))?([\.](
[0-9]+))?$/,
"alertText": "* Khng dng l s? th?p phn"
},
"date": {
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3
[01])$/,
"alertText": "* Ngy sai, ph?i c d?nh d?ng YYYY-MM-DD"
},
"ipv4": {
"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]))$/,
"alertText": "* ?a ch? IP sai"
},
"url": {
"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-\u
D7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\u
FFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\
u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDC

F\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\
.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uF
DCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uF
DCF\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,
"alertText": "* URL sai"
},
"onlyNumberSp": {
"regex": /^[0-9\ ]+$/,
"alertText": "* Ch? di?n s?"
},
"onlyLetterSp": {
"regex": /^[a-zA-Z\ \']+$/,
"alertText": "* Ch? di?n ch?"
},
"onlyLetterNumber": {
"regex": /^[0-9a-zA-Z]+$/,
"alertText": "* Khng du?c ch?a k t? d?c bi?t"
},
// --- CUSTOM RULES -- Those are specific to the demos, they can be
removed or changed to your likings
"ajaxUserCall": {
"url": "ajaxValidateFieldUser",
// you may want to pass extra data on the ajax call
"extraData": "name=eric",
"alertText": "* Tn ny du?c dng",
"alertTextLoad": "* ang xc nh?n, vui lng ch?"
},
"ajaxUserCallPhp": {
"url": "phpajax/ajaxValidateFieldUser.php",
// you may want to pass extra data on the ajax call
"extraData": "name=eric",
// if you provide an "alertTextOk", it will show as a green prom
pt when the field validates
"alertTextOk": "* Tn ngu?i dng ny c th? dng du?c",
"alertText": "* Tn ngu?i dng ny d du?c s? d?ng",
"alertTextLoad": "* ang xc nh?n, vui lng ch?"
},
"ajaxNameCall": {
// remote json service location
"url": "ajaxValidateFieldName",
// error
"alertText": "* Tn ny du?c dng",
// if you provide an "alertTextOk", it will show as a green prom
pt when the field validates
"alertTextOk": "* Tn ny c th? dng",
// speaks by itself
"alertTextLoad": "* ang xc nh?n, vui lng ch?"
},
"ajaxNameCallPhp": {
// remote json service location
"url": "phpajax/ajaxValidateFieldName.php",
// error
"alertText": "* Tn ny du?c dng",
// speaks by itself
"alertTextLoad": "* ang xc nh?n, vui lng ch?"

},
"validate2fields": {
"alertText": "* Vui lng nh?p vo HELLO"
},
//tls warning:homegrown not fielded
"dateFormat":{
"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]))$/,
"alertText": "* Ngy sai"
},
//tls warning:homegrown not fielded
"dateTimeFormat": {
"regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][09]|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})$/,
"alertText": "* Ngy sai ho?c d?nh d?ng ngy sai",
"alertText2": "?nh d?ng dng l: ",
"alertText3": "mm/dd/yyyy hh:mm:ss AM|PM hay ",
"alertText4": "yyyy-mm-dd hh:mm:ss AM|PM"
}
};
}
};
$.validationEngineLanguage.newLang();

You might also like