UNPKG

@vks-dev/jquery-validation-engine

Version:

jQuery Validation Engine 2.6.2 - Form validation engine with custom regex rules - VKS package

177 lines (175 loc) 8.4 kB
(function($){ $.fn.validationEngineLanguage = function(){ }; $.validationEngineLanguage = { newLang: function(){ $.validationEngineLanguage.allRules = { "required": { // Add your regex rules here, you can take telephone as an example "regex": "none", "alertText": "* Camp obligatoriu", "alertTextCheckboxMultiple": "* Selecteaza o optiune", "alertTextCheckboxe": "* Optiune obligatorie", "alertTextDateRange": "* Campurile data cu ajutorul carora se stabileste perioada sunt obligatorii" }, "requiredInFunction": { "func": function(field, rules, i, options){ return (field.val() == "test") ? true : false; }, "alertText": "* Field must equal test" }, "dateRange": { "regex": "none", "alertText": "* Perioada ", "alertText2": "este invalida" }, "dateTimeRange": { "regex": "none", "alertText": "* Intervalul de timp ", "alertText2": "este invalid" }, "minSize": { "regex": "none", "alertText": "* Sunt permise cel putin ", "alertText2": " caractere" }, "maxSize": { "regex": "none", "alertText": "* Sunt permise maxim ", "alertText2": " caractere" }, "groupRequired": { "regex": "none", "alertText": "* Trebuie sa completezi unul dintre urmatoarele campuri" }, "min": { "regex": "none", "alertText": "* Valoarea minim admisa este " }, "max": { "regex": "none", "alertText": "* Valoarea maxim admisa este " }, "past": { "regex": "none", "alertText": "* Data trebuie sa fie una anterioara fata de " }, "future": { "regex": "none", "alertText": "* Data este una din trecut fata de " }, "maxCheckbox": { "regex": "none", "alertText": "* Maximul de optiuni permise este ", "alertText2": "" }, "minCheckbox": { "regex": "none", "alertText": "* Selecteaza minim ", "alertText2": " optiuni" }, "equals": { "regex": "none", "alertText": "* Campurile nu au fost completate identic" }, "creditCard": { "regex": "none", "alertText": "* Nevalid num?rul de card de credit" }, "phone": { // credit: jquery.h5validate.js / orefalo "regex": /^([\+][0-9]{1,3}[ \.\-])?([\(]{1}[0-9]{2,6}[\)])?([0-9 \.\-\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/, "alertText": "* Numarul de telefon este scris eronat" }, "email": { // Shamelessly lifted from Scott Gonzalez via the Bassistance Validation plugin http://projects.scottsplayground.com/email_address_validation/ "regex": /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)+$/, "alertText": "* Adresa e-mail este scrisa gresit" }, "integer": { "regex": /^[\-\+]?\d+$/, "alertText": "* Nu este un numar intreg" }, "number": { // Number, including positive, negative, and floating decimal. credit: orefalo "regex": /^[\-\+]?(([0-9]+)([\.,]([0-9]+))?|([\.,]([0-9]+))?)$/, "alertText": "* Trebuie sa fie un numar" }, "date": { "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, "alertText": "* Data nu este corecta. Aceasta trebuie sa fie scrisa sub forma 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": "* Adresa IP nu este corecta" }, "url": { "regex": /^(https?|ftp):\/\/[^\s<>]+\.[^\s<>]+$/i, "alertText": "* URL gresit" }, "onlyNumberSp": { "regex": /^[0-9\ ]+$/, "alertText": "* Sunt permise doar numerele" }, "onlyLetterSp": { "regex": /^[a-zA-Z\ \']+$/, "alertText": "* Sunt admise doar literele" }, "onlyLetterNumber": { "regex": /^[0-9a-zA-Z]+$/, "alertText": "* Trebuie sa folosesti doar litere si numere intregi" }, // --- 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": "* Numele utilizator nu este disponibil", "alertTextLoad": "* Se efectueaza validarea. Asteapta..." }, "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 prompt when the field validates "alertTextOk": "* Numele utilizator este disponibil", "alertText": "* Numele utilizator nu este disponibil", "alertTextLoad": "* Se efectueaza validarea. Asteapta..." }, "ajaxNameCall": { // remote json service location "url": "ajaxValidateFieldName", // error "alertText": "* Numele nu este disponibil", // if you provide an "alertTextOk", it will show as a green prompt when the field validates "alertTextOk": "* Numele este disponibil", // speaks by itself "alertTextLoad": "* Se efectueaza validarea. Asteapta..." }, "ajaxNameCallPhp": { // remote json service location "url": "phpajax/ajaxValidateFieldName.php", // error "alertText": "* Numele nu este disponibil", // speaks by itself "alertTextLoad": "* Se efectueaza validarea. Asteapta..." }, "validate2fields": { "alertText": "* Scrie: HELLO" }, //tls warning:homegrown not fielded "dateFormat":{ "regex": /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01])$/, "alertText": "* Data nu este corecta" }, //tls warning:homegrown not fielded "dateTimeFormat": { "regex": /^\d{4}-(0[1-9]|1[012])-(0[1-9]|[12]\d|3[01]) ([01]\d|2[0-3]):[0-5]\d:[0-5]\d$/, "alertText": "* Data nu este corecta sau formatul acesteia este unul gresit", "alertText2": "Formatele recunoscute sunt: ", "alertText3": "yyyy-mm-dd hh:mm:ss" } }; } }; $.validationEngineLanguage.newLang(); })(jQuery);