diff --git a/Gruntfile.js b/Gruntfile.js index bfc0590..1eef85c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -98,7 +98,10 @@ function initializeGruntConfig(grunt) { watch: { files: [SRC_DIR + '/**'], tasks: ['test'], - options: { nospawn: true} + options: { + nospawn: true, + livereload: true + } }, // Unit tests @@ -111,8 +114,7 @@ function initializeGruntConfig(grunt) { server: { options: { port: 8000, - base: '.', - keepalive: true + base: '.' } } }, @@ -201,6 +203,6 @@ module.exports = function (grunt) { grunt.registerTask("build-production", ["version", "test", "uglify"]); grunt.registerTask('build', ['concat', 'copy', 'umd', 'cssmin']); grunt.registerTask('test', ['build','jshint', 'qunit']); - grunt.registerTask("default", ["test", "watch"]); + grunt.registerTask("default", ["test", "connect", "watch"]); grunt.registerTask("prepublish", ["test", "uglify"]); }; diff --git a/README.md b/README.md index ba2ead0..e1e957b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -# jQuery Form Validator +# jQuery Form Validator [DISCONTINUED] -jQuery Form Validator is a **feature rich and multilingual** jQuery plugin that makes it easy to validate user input while keeping your HTML markup clean from javascript code. Even though this plugin has a wide range of validation functions it's **designed to require as little network traffic as possible**. This is achieved by grouping together validation functions in "modules", making it possible to load only those functions that's needed to validate a particular form. +*Validation framework that let's you configure, rather than code, your validation logic.* -**Form demos and full documentation available at http://formvalidator.net/** +I started writing this plugin back in 2009 and it has given me much joy over the years. But all good things must come to an end and now it's time for this plugin to pull in its oars and go down with history. -[![Travis](https://travis-ci.org/victorjonsson/PHP-Markdown-Documentation-Generator.svg)](https://travis-ci.org/victorjonsson/jQuery-Form-Validator/builds/) +**This plugin is no longer being developed!** It supports jQuery v. 1.8 >= 2.2.4. No pull requests will become merged in but feel free to fork and do whatever you like! + +[![Travis](https://travis-ci.org/victorjonsson/jQuery-Form-Validator.svg)](https://travis-ci.org/victorjonsson/jQuery-Form-Validator/builds/) [![npm version](https://badge.fury.io/js/jquery-form-validator.svg)](https://www.npmjs.com/package/jquery-form-validator) @@ -39,7 +41,7 @@ jQuery Form Validator is a **feature rich and multilingual** jQuery plugin that ### Support for HTML5 -This plugin can serve as a fallback solution for the validation attributes in the HTML5 spec. With the [html5](http://www.formvalidator.net/#configuration_html5) module you can use the following native features: +This plugin can serve as a fallback solution for the validation attributes in the HTML5 spec. With the html5 module you can use the following native features: **Attributes**: require, pattern, maxlength, min, max, placeholder @@ -68,7 +70,7 @@ This plugin can serve as a fallback solution for the validation attributes in th * Create input suggestions with ease, no jquery-ui needed * to apply multiple validators to an input element, separate the validator names using a space (ex: required email) -Read the documentation for the default features at [http://formvalidator.net/#default-validators](http://formvalidator.net/#default-validators) +Read the documentation for the default features at [#default-validators](#default-validators) ### Module: security * **spamcheck** @@ -78,15 +80,15 @@ Read the documentation for the default features at [http://formvalidator.net/#de * **strength** — *Validate the strength of a password* * **server** — *Validate value of input on server side* * **letternumeric** — *Validate that the input value consists out of only letters and/or numbers* - * **recaptcha** - *Validate Google [reCaptcha 2](https://www.google.com/recaptcha/intro/index.html)* + * **recaptcha** - *Validate Google [reCaptcha 2](https://www.google.com/recaptcha/intro/index.html)* -Read the documentation for the security module at [http://formvalidator.net/#security-validators](http://formvalidator.net/#security-validators) +Read the documentation for the security module at [#security-validators](#security-validators) ### Module: date * **time** — *hh:mm* * **birthdate** — *yyyy-mm-dd, not allowing dates in the future or dates that's older than 122 years (format can be customized, more information below)* -Read the documentation for the date module at [http://formvalidator.net/#date-validators](http://formvalidator.net/#date-validators) +Read the documentation for the date module at [#date-validators](#date-validators) ### Module: location * **country** @@ -95,7 +97,7 @@ Read the documentation for the date module at [http://formvalidator.net/#date-va * Suggest countries (english only) * Suggest states in the US -Read the documentation for the location module at [http://formvalidator.net/#location-validators](http://formvalidator.net/#location-validators) +Read the documentation for the location module at [#location-validators](/#location-validators) ### Module: file * **mime** @@ -103,14 +105,14 @@ Read the documentation for the location module at [http://formvalidator.net/#loc * **size** (file size) * **dimension** (size dimension and ratio) -Read the documentation for the file module at [http://formvalidator.net/#file-validators](http://formvalidator.net/#file-validators) +Read the documentation for the file module at [#file-validators](#file-validators) ### Module: logic * **Dependent validation** * **Require "one-of"** -Read the documentation for this module at [http://formvalidator.net/#logic](http://www.formvalidator.net/#logic) +Read the documentation for this module at [/#logic](#logic) ### Module: sepa @@ -133,8 +135,8 @@ Read the documentation for the Swedish module at [http://formvalidator.net/#swed ### Module: uk * **ukvatnumber** - * **uknin** - * **ukutr** + * **uknin** + * **ukutr** Read the documentation for the UK module at [http://formvalidator.net/#uk-validators](http://www.formvalidator.net/#country-specific-validators_uk) @@ -143,11 +145,18 @@ Read the documentation for the UK module at [http://formvalidator.net/#uk-valida * **cep** * **cpf** -### Module: poland +### Module: poland * **plpesel** - *validate polish personal identity number (in Polish identity cards)* * **plnip** - *validate polish VAT identification number* * **plregon** - *validate polish bussiness identity number* +### Module: color + * **hex** - *validate hex color format* + * **rgb** - *validate rgb color format* + * **rgba** - *validate rgba color format* + * **hsl** - *validate hsl color format* + * **hsla** - *validate hsla color format* + ### Module: sanitation * **trim** * **trimLeft** @@ -271,6 +280,684 @@ This plugin comes with translations for English, Polish, Portuguese. You can also choose to override the error dialogs yourself. Here you can read more about [localization](http://formvalidator.net/#localization) +# Default validators + +### Answer length (required) + +``` + + + + + + + + + + + + + + + + +``` +This plugin also supports the attributes "required" and "maxlength" by using the Html5 module. + +### Numbers +``` + + + + + + + + + + + + + + + + + + + + +You can also define the decimal separator when initializing the validation. + +

+ Average points
+ +

+ .... + + +``` +Inputs of type "number" will also become validated by loading the html5 module. + +### E-mail +``` + +``` +Inputs of type "email" will also become validated by loading the html5 module. + +### URL:s + +``` + +``` +Inputs of type "url" will also become validated by loading the html5 module. + +### Date + +``` + + + + + + + + +``` + +See the date module for further validators. + +### Alphanumeric + +``` + + + + + +``` +If you want to allow any kind of letters (not only A-Z) you're looking for the letternumeric validator. + +### Checkboxes Group +Validate qty of checkboxes in a group (same name) have been checked, using min, max or range. Only the first checkbox element in the group needs to have the validation attributes added. +``` + + + + + + +If your checkboxes group is generated by a server-side script and you don't want to add the validation attributes to each input element, you can use this javascript snippet before calling the validatorLoad() function + + + +Regexp + + +``` + +This plugin also supports the attribute "pattern" by using the Html5 module. + +### Character count down +``` +

+ History (50 characters left) + +

+ +``` +### Make validation optional +``` + + +``` +You can also use the logic module if you want the validation of an input depend on another input having a value. + +### Display help text +It is possible to display help information beside each input. The text will fade in when the input gets focus on and fade out when the input looses focus. The container for the help text will have the class form-help. If you don't want this feature you can read the setup guide on how to disable it. + +``` +
+

+ Why not? + +

+ ... +
+ ``` +### Validate inputs when blurred + +By default each input will become validated immediately when the input looses focus. If you don't want this feature you can read the setup guide on how to disable it. + +### Input suggestions +There are two ways you can give suggestions to the user while the user types. + +1) Using attribute data-suggestions + +``` +

+ What's your favorite color? + +

+ ... + +``` +2) Using $.formUtils.suggest() +``` + +``` +This plugin also supports the data-list element by using the Html5 module. + +Ignoring characters +You can tell any validator to ignore certain characters by using the attribute data-validation-ignore (comma separated list). +``` +

+ How much do you want to donate? + + +

+``` + +## Security validators< + +### Password confirmation + +This validator can be used to validate that the values of two inputs are the same. The first input should have a name suffixed with _confirmation and the second should have the same name but without the suffix. + +``` +

+ Password (at least 8 characters) + + + Confirm password + +

+``` + +``` +

+ E-mail + + + Repeat e-mail + +

+``` + +### Password strength + +Use this validator to make sure that your user has a strong enough password. Set attribute data-validation-strength to 1, 2 or 3 depending on how strong password you require. + +If you want the strength of the password to be displayed while the user types you call displayPasswordStrength() in the end of the form. + +``` +
+

+ Password: + +

+ ... +
+ + + + +``` + +### Server side validation + +By using this validator you can validate the value given by the user on the server before the form gets submitted. The validation function will send a POST request to the URL declared in data-validation-url. The argument posted to the URL will have the same name as the input being validated. + +The form will get the class validating-server-side while the server is being requested. + +The response from the validation script must be a JSON formatted object, containing the properties "valid" and "message". + +``` +{ + "valid" : true|false, + "message" : "String with text that should be displayed as error message" +} +``` + +#### Form + +``` +
+

+ User name: + +

+ ... +
+``` + +#### /validate-input.php + +``` + false, + 'message' => 'Post argument "user" is missing.' +); + +if( isset($_POST['user']) ) { + $userRepo = new UserRepository( DataStorage::instance() ); + $user = $userRepo->loadUser( $_POST['user'] ); + + if( $user ) { + // User name is registered on another account + $response = array('valid' => false, 'message' => 'This user name is already registered.'); + } else { + // User name is available + $response = array('valid' => true); + } +} +echo json_encode($response); +``` + +**Modifying the server request** + +The parameter containing the input value, sent to the server, will by default have the same name as the input. You can however set your own parameter name by using the attribute data-validation-param-name. You can also send along other parameters to the server by using the attribute data-validation-req-params. + +``` +$user->get('ID'))); +?> +

+ E-mail: + +

+``` + +### Credit card validation + +This validator makes it possible to validate any of the credit cards VISA, Mastercard, Diners club, Maestro, CJB, Discover and American express + +``` +<-- Accept credit card number from Visa, Mastercard and American Express --> +

+ Credit card number + +

+

+ Security code (cvv) + +

+``` + +You can also let the user choose a credit card and programmatically change the allowed credit card on the input of the card number. + +``` +

+ Credit card + +

+

+ Credit card number + +

+... + + +``` + +### Simple captcha + +``` + +
+

+ What is the sum of + ? + (security question) + +

+

+
+``` + +### Google reCAPTCHA + +Use this validator if wanting to integrate the Google service reCAPTCHA. + +``` +

+ +

+``` + +You can also use the setup function to configure the recaptcha service. + +``` +$.validate({ + reCaptchaSiteKey: '...', + reCaptchaTheme: 'light' +}); +``` + +### Letters and numbers + +By using the validator letternumeric you can validate that given input value only contains letters and/or numbers. This validator allows any type of character in contrast to the alphanumeric validator, which only allows letters A-Z. + +``` + + + + + +``` + +## Date validators + +### Birthdate + +This validator is the same as the default date validator except that it only allows past dates and dates that is not older than 120 years. + +``` + + + + + + + + +``` + +## Time + +``` + + +``` + + +## Location validators + +### Country + +``` + + +``` + +### State (US) + +``` + + +``` + +### Longitude and Latitude + +``` + + +``` + +### Suggest country/state + +By using this function you'll make it easier for your visitor to input a country or state. + +``` +
+ ... +

+ Which country are you from? + +

+

+ Which state do you live in? + +

+
+ + + + +``` + +## File validators + +### File size + +This validation is only supported by Internet Explorer 10, Mozilla FireFox v >= 3.6 and any of the later versions of webkit based browsers. + +``` + + + + + +``` + +### File type + +This validation will fall back on checking the file extension in older browsers. In modern browsers the validation will check that any of the extensions in data-validation-allowing exists in the mime type declaration of the file. This means that data-validation-allowing="pdf" will work in both modern browsers (checking against "application/pdf") and older browsers (checking the file extension ".pdf"). + +``` + + + + + +``` + +Validating multiple files (with separate error messages depending on failed validation): + +``` + +``` + +### Image dimension and ratio + +Use the validator dimension to check the dimension of an image (jpg, gif or png). + +``` + + + + + + + + + + + + + + +``` + +Use the attribute data-validation-ratio to validate that the uploaded image has a certain ratio + +``` + + + + + +``` + +## Logic + +### Validators depending on each other + +Use the attributes data-validation-depends-on to configure that an input is optional as long as another input is left without an answer. + +``` + +

+ Contact me: + +

+

+ E-mail: + +

+``` + +``` + +

+ Country: + +

+ +

+ State: + +

+ +... + + + +``` + +### Require only one out of several inputs + +Use the attribute data-validation-optional-if-answered to tell the validator that only one, out of a group of inputs, requires an answer. + +``` +

+ Home phone number: + +

+

+ Cell phone number: + +

+

+ Work phone number: + +

+ +``` + ## Changelog #### 2.3.19 diff --git a/form-validator/brazil.js b/form-validator/brazil.js index 3fee483..12d9e1b 100644 --- a/form-validator/brazil.js +++ b/form-validator/brazil.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/color.js b/form-validator/color.js new file mode 100644 index 0000000..b7f8a17 --- /dev/null +++ b/form-validator/color.js @@ -0,0 +1,9 @@ +/** File generated by Grunt -- do not modify + * JQUERY-FORM-VALIDATOR + * + * @version 2.3.79 + * @website http://formvalidator.net/ + * @author Victor Jonsson, http://victorjonsson.se + * @license MIT + */ +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a){a.formUtils.registerLoadedModule("color");var b=function(a){return/^(\-|\+)?([0-9]+(\.[0-9]+)?|Infinity)$/.test(a)?Number(a):NaN},c=function(a){return a>0&&a<1},d=function(b){return Math.floor(b)===b&&a.isNumeric(b)};a.formUtils.addValidator({name:"hex",validatorFunction:function(a,b){if("true"===b.valAttr("allow-transparent")&&"transparent"===a)return!0;var c="#"===a[0];if(!c)return!1;var d=4===a.length||7===a.length;if(d){var e=/[0-9a-f]/i,f=a.slice(1).split(""),g=!0;return f.forEach(function(a){null===a.match(e)&&(g=!1)}),g}return!1},errorMessage:"",errorMessageKey:"badHex"}),a.formUtils.addValidator({name:"rgb",validatorFunction:function(a,b){if("true"===b.valAttr("allow-transparent")&&"transparent"===a)return!0;var c=a.replace(/ /g,""),e=/rgb\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3}\)/i;if(c.match(e)){var f=c.replace(/rgb/g,""),g=f.replace(/\(/g,"").replace(/\)/g,""),h=g.split(","),i=!0;return h.forEach(function(a){var b=parseInt(a,10);(d(b)&&0<=b&&b<=255)===!1&&(i=!1)}),i}return!1},errorMessage:"",errorMessageKey:"badRgb"}),a.formUtils.addValidator({name:"rgba",validatorFunction:function(a,e){if("true"===e.valAttr("allow-transparent")&&"transparent"===a)return!0;var f=a.replace(/ /g,""),g=/rgba\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0,1]?.?[0-9]*\)/i;if(f.match(g)){var h=f.replace(/rgba/g,""),i=h.replace(/\(/g,"").replace(/\)/g,""),j=i.split(","),k=!0;return j.forEach(function(a,e){var f=b(a);if(d(f)){var g=f>=0&&f<=255;g||(k=!1),k&&3===e&&(k=f>=0&&f<2)}else c(a)||(k=!1)}),k}return!1},errorMessage:"",errorMessageKey:"badRgba"}),a.formUtils.addValidator({name:"hsl",validatorFunction:function(a,b){if("true"===b.valAttr("allow-transparent")&&"transparent"===a)return!0;var c=a.replace(/ /g,""),e=/hsl\(-?[0-9]{1,3},[0-9]{1,3}%,[0-9]{1,3}%\)/i;if(c.match(e)){var f=c.replace(/hsl/g,""),g=f.replace(/\(/g,"").replace(/\)/g,""),h=g.split(","),i=!0;return h.forEach(function(a,b){var c=parseInt(a,10);if(d(c)){if(0!==b){var e=c>=0&&c<=100;e||(i=!1)}}else i=!1}),i}return!1},errorMessage:"",errorMessageKey:"badHsl"}),a.formUtils.addValidator({name:"hsla",validatorFunction:function(a,c){if("true"===c.valAttr("allow-transparent")&&"transparent"===a)return!0;var e,f=a.replace(/ /g,""),g=/hsla\(-?[0-9]{1,3},[0-9]{1,3}%,[0-9]{1,3}%,[0,1]?.?[0-9]*\)/i;if(f.match(g)){var h=f.replace(/hsla/g,""),i=h.replace(/\(/g,"").replace(/\)/g,""),j=i.split(","),k=!0;return j.forEach(function(a,c){var f=b(a),g=parseInt(a,10);d(f)?(0!==c&&3!==c&&(e=f>=0&&f<=100,e||(k=!1)),k&&3===c&&(k=f>=0&&f<2)):isNaN(f)&&d(g)?(e=g>=0&&g<=100,e||(k=!1)):(f=b(Number(a).toFixed(20)),e=f>=0&&f<=1,e||(k=!1))}),k}return!1},errorMessage:"",errorMessageKey:"badHsla"})}(a)}); \ No newline at end of file diff --git a/form-validator/date.js b/form-validator/date.js index bcf138a..ad744d3 100644 --- a/form-validator/date.js +++ b/form-validator/date.js @@ -1,9 +1,9 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT */ -!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a){function b(a,b,c){var d=new Date,e=new Date;return d.setYear(a),d.setMonth(b),d.setDate(c),new Date(e.getTime()-d.getTime()).getUTCFullYear()-1970}a.formUtils.registerLoadedModule("date"),a.formUtils.addValidator({name:"time",validatorFunction:function(a){if(null===a.match(/^(\d{2}):(\d{2})$/))return!1;var b=parseInt(a.split(":")[0],10),c=parseInt(a.split(":")[1],10);return!(b>23||c>59)},errorMessage:"",errorMessageKey:"badTime"}),a.formUtils.addValidator({name:"birthdate",validatorFunction:function(c,d,e){var f="yyyy-mm-dd";d.valAttr("format")?f=d.valAttr("format"):"undefined"!=typeof e.dateFormat&&(f=e.dateFormat);var g=a.formUtils.parseDate(c,f);if(!g)return!1;var h=g[0],i=g[1],j=g[2],k=b(h,i,j),l=(d.valAttr("age-range")||"0-124").split("-");if(2!==l.length||!a.isNumeric(l[0])||!a.isNumeric(l[1]))throw new Error("Date range format invalid");return k>=l[0]&&k<=l[1]},errorMessage:"",errorMessageKey:"badDate"})}(a)}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a){function b(a,b,d){var e=new Date(a,b,d),f=new Date,g=f.getFullYear()-e.getFullYear();e.setFullYear(e.getFullYear()+g),e>f&&(g--,e.setFullYear(e.getFullYear()-1));var h=Math.floor((f.getTime()-e.getTime())/864e5),i=g+h/(c(f.getFullYear())?366:365),j=((i+"").split(".")[1]||"").substr(0,3);return i>=0?Math.floor(i)+(j>=915?1:0):(j*=10,Math.floor(i)+(j<=840?1:0))}function c(a){var b=new Date(a,1,28);return b.setDate(b.getDate()+1),1===b.getMonth()}a.formUtils.registerLoadedModule("date"),a.formUtils.addValidator({name:"time",validatorFunction:function(a){if(null===a.match(/^(\d{2}):(\d{2})$/))return!1;var b=parseInt(a.split(":")[0],10),c=parseInt(a.split(":")[1],10);return!(b>23||c>59)},errorMessage:"",errorMessageKey:"badTime"}),a.formUtils.addValidator({name:"birthdate",validatorFunction:function(c,d,e){var f="yyyy-mm-dd";d.valAttr("format")?f=d.valAttr("format"):"undefined"!=typeof e.dateFormat&&(f=e.dateFormat);var g=a.formUtils.parseDate(c,f);if(!g)return!1;var h=g[0],i=g[1],j=g[2],k=b(h,i,j),l=(d.valAttr("age-range")||"0-124").split("-");if(d.trigger("ageCalculated",[k]),2!==l.length||!a.isNumeric(l[0])||!a.isNumeric(l[1]))throw new Error("Date range format invalid");return k>=l[0]&&k<=l[1]},errorMessage:"",errorMessageKey:"badDate"})}(a)}); \ No newline at end of file diff --git a/form-validator/file.js b/form-validator/file.js index 6db9d49..0e887a6 100644 --- a/form-validator/file.js +++ b/form-validator/file.js @@ -1,9 +1,9 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT */ -!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){a.formUtils.registerLoadedModule("file");var c="undefined"!=typeof b.FileReader,d=function(b){var c=a.split((b.valAttr("allowing")||"").toLowerCase());return a.inArray("jpg",c)>-1&&a.inArray("jpeg",c)===-1?c.push("jpeg"):a.inArray("jpeg",c)>-1&&a.inArray("jpg",c)===-1&&c.push("jpg"),c},e=function(a,b,c,d){var e=d[b]||"";a.errorMessageKey="",a.errorMessage=e.replace("%s",c)},f=function(c,d,e){var f=new FileReader,g=new Image;f.readAsDataURL(c),f.onload=function(c){g.onload=function(){a(b).trigger("imageValidation",[this]),d(this)},g.onerror=function(){e()},g.src=c.target.result}};a.formUtils.addValidator({name:"mime",validatorFunction:function(b,f,g,h){if(c){var i=!0,j=f.get(0).files||[],k="",l=d(f);return j.length&&(a.each(j,function(b,c){return i=!1,k=c.type||c.name.substring(c.name.lastIndexOf(".")+1),a.each(l,function(a,b){if(i=k.indexOf(b)>-1)return!1}),i}),i||(a.formUtils.warn("Trying to upload a file with mime type "+k+" which is not allowed"),e(this,"wrongFileType",l.join(", "),h))),i}return a.formUtils.warn("FileReader not supported by browser, will check file extension"),a.formUtils.validators.validate_extension.validatorFunction(b,f,g,h)},errorMessage:"",errorMessageKey:"wrongFileType"}),a.formUtils.addValidator({name:"extension",validatorFunction:function(b,c,f,g){var h=!0,i=this,j=d(c);return a.each(c.get(0).files||[b],function(b,c){var d="string"==typeof c?c:c.value||c.fileName||c.name,f=d.substr(d.lastIndexOf(".")+1);if(a.inArray(f.toLowerCase(),j)===-1)return h=!1,e(i,"wrongFileType",j.join(", "),g),!1}),h},errorMessage:"",errorMessageKey:"wrongFileType"}),a.formUtils.addValidator({name:"size",validatorFunction:function(b,d,f,g){var h=d.valAttr("max-size");if(!h)return a.formUtils.warn('Input "'+d.attr("name")+'" is missing data-validation-max-size attribute',!0),!0;if(!c)return!0;var i=a.formUtils.convertSizeNameToBytes(h),j=!0;return a.each(d.get(0).files||[],function(a,b){return j=b.size<=i}),j||e(this,"wrongFileSize",h,g),j},errorMessage:"",errorMessageKey:"wrongFileSize"}),a.formUtils.convertSizeNameToBytes=function(a){return a=a.toUpperCase(),"M"===a.substr(a.length-1,1)?1024*parseInt(a.substr(0,a.length-1),10)*1024:"MB"===a.substr(a.length-2,2)?1024*parseInt(a.substr(0,a.length-2),10)*1024:"KB"===a.substr(a.length-2,2)?1024*parseInt(a.substr(0,a.length-2),10):"B"===a.substr(a.length-1,1)?parseInt(a.substr(0,a.length-1),10):parseInt(a,10)},a.formUtils.checkImageDimension=function(a,b,c){var d=!1,e={width:0,height:0},f=function(a){a=a.replace("min","").replace("max","");var b=a.split("x");e.width=b[0],e.height=b[1]?b[1]:b[0]},g=!1,h=!1,i=b.split("-");return 1===i.length?0===i[0].indexOf("min")?g=i[0]:h=i[0]:(g=i[0],h=i[1]),g&&(f(g),(a.widthe.width||a.height>e.height)&&(d=a.width>e.width?c.imageTooWide+" "+e.width+"px":c.imageTooTall+" "+e.height+"px",d+=" ("+c.max+" "+e.width+"x"+e.height+"px)")),d},a.formUtils.checkImageRatio=function(a,b,c){var d=a.width/a.height,e=function(a){var b=a.replace("max","").replace("min","").split(":");return b[0]/b[1]},f=b.split("-"),g=function(a,b,c){return a>=b&&a<=c};if(1===f.length){if(d!==e(f[0]))return c.imageRatioNotAccepted}else if(2===f.length&&!g(d,e(f[0]),e(f[1])))return c.imageRatioNotAccepted;return!1},a.formUtils.addAsyncValidator({name:"dimension",validatorFunction:function(b,d,e,g,h){if(c){var i=e.get(0).files||[],j=this;e.attr("data-validation").indexOf("mime")===-1?(alert("You should validate file type being jpg, gif or png on input "+e[0].name),b(!1)):i.length>1?(alert("Validating image dimensions does not support inputs allowing multiple files"),b(!1)):0===i.length?b(!0):f(i[0],function(c){var d=!1;e.valAttr("dimension")&&(d=a.formUtils.checkImageDimension(c,e.valAttr("dimension"),h)),!d&&e.valAttr("ratio")&&(d=a.formUtils.checkImageRatio(c,e.valAttr("ratio"),h)),d?(j.errorMessage=h.wrongFileDim+" "+e.valAttr("has-not-valid-dim"),b(!1)):b(!0)},function(a){throw a})}else b(!0)},errorMessage:"",errorMessageKey:""}),a(b).one("validatorsLoaded formValidationSetup",function(b,c,d){var e;e=c?c.find('input[type="file"]'):a('input[type="file"]'),a.formUtils.dialogs.removeInputStylingAndMessage(e,d)})}(a,window)}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){a.formUtils.registerLoadedModule("file");var c="undefined"!=typeof b.FileReader,d=function(b){var c=(b.valAttr("allowing")||"").toLowerCase().split(/,\s*/);return a.inArray("jpg",c)>-1&&a.inArray("jpeg",c)===-1?c.push("jpeg"):a.inArray("jpeg",c)>-1&&a.inArray("jpg",c)===-1&&c.push("jpg"),c},e=function(a,b,c,d){var e=d[b]||"";a.errorMessageKey="",a.errorMessage=e.replace("%s",c)},f=function(c,d,e){var f=new FileReader,g=new Image;f.readAsDataURL(c),f.onload=function(c){g.onload=function(){a(b).trigger("imageValidation",[this]),d(this)},g.onerror=function(){e()},g.src=c.target.result}};a.formUtils.addValidator({name:"mime",validatorFunction:function(b,f,g,h){if(c){var i=!0,j=f.get(0).files||[],k="",l=d(f);return j.length&&(a.each(j,function(b,c){return i=!1,k=c.type||c.name.substring(c.name.lastIndexOf(".")+1),a.each(l,function(a,b){if(i=k.indexOf(b)>-1)return!1}),i}),i||(a.formUtils.warn("Trying to upload a file with mime type "+k+" which is not allowed"),e(this,"wrongFileType",l.join(", "),h))),i}return a.formUtils.warn("FileReader not supported by browser, will check file extension"),a.formUtils.validators.validate_extension.validatorFunction(b,f,g,h)},errorMessage:"",errorMessageKey:"wrongFileType"}),a.formUtils.addValidator({name:"extension",validatorFunction:function(b,c,f,g){var h=!0,i=this,j=d(c);return a.each(c.get(0).files||[b],function(b,c){var d="string"==typeof c?c:c.value||c.fileName||c.name,f=d.substr(d.lastIndexOf(".")+1);if(a.inArray(f.toLowerCase(),j)===-1)return h=!1,e(i,"wrongFileType",j.join(", "),g),!1}),h},errorMessage:"",errorMessageKey:"wrongFileType"}),a.formUtils.addValidator({name:"size",validatorFunction:function(b,d,f,g){var h=d.valAttr("max-size");if(!h)return a.formUtils.warn('Input "'+d.attr("name")+'" is missing data-validation-max-size attribute',!0),!0;if(!c)return!0;var i=a.formUtils.convertSizeNameToBytes(h),j=!0;return a.each(d.get(0).files||[],function(a,b){return j=b.size<=i}),j||e(this,"wrongFileSize",h,g),j},errorMessage:"",errorMessageKey:"wrongFileSize"}),a.formUtils.convertSizeNameToBytes=function(a){return a=a.toUpperCase(),"M"===a.substr(a.length-1,1)?1024*parseInt(a.substr(0,a.length-1),10)*1024:"MB"===a.substr(a.length-2,2)?1024*parseInt(a.substr(0,a.length-2),10)*1024:"KB"===a.substr(a.length-2,2)?1024*parseInt(a.substr(0,a.length-2),10):"B"===a.substr(a.length-1,1)?parseInt(a.substr(0,a.length-1),10):parseInt(a,10)},a.formUtils.checkImageDimension=function(a,b,c){var d=!1,e={width:0,height:0},f=function(a){a=a.replace("min","").replace("max","");var b=a.split("x");e.width=b[0],e.height=b[1]?b[1]:b[0]},g=!1,h=!1,i=b.split("-");return 1===i.length?0===i[0].indexOf("min")?g=i[0]:h=i[0]:(g=i[0],h=i[1]),g&&(f(g),(a.widthe.width||a.height>e.height)&&(d=a.width>e.width?c.imageTooWide+" "+e.width+"px":c.imageTooTall+" "+e.height+"px",d+=" ("+c.max+" "+e.width+"x"+e.height+"px)")),d},a.formUtils.checkImageRatio=function(a,b,c){var d=a.width/a.height,e=function(a){var b=a.replace("max","").replace("min","").split(":");return b[0]/b[1]},f=b.split("-"),g=function(a,b,c){return a>=b&&a<=c};if(1===f.length){if(d!==e(f[0]))return c.imageRatioNotAccepted}else if(2===f.length&&!g(d,e(f[0]),e(f[1])))return c.imageRatioNotAccepted;return!1},a.formUtils.addAsyncValidator({name:"dimension",validatorFunction:function(b,d,e,g,h){if(c){var i=e.get(0).files||[],j=this;e.attr("data-validation").indexOf("mime")===-1?(alert("You should validate file type being jpg, gif or png on input "+e[0].name),b(!1)):i.length>1?(alert("Validating image dimensions does not support inputs allowing multiple files"),b(!1)):0===i.length?b(!0):f(i[0],function(c){var d=!1;e.valAttr("dimension")&&(d=a.formUtils.checkImageDimension(c,e.valAttr("dimension"),h)),!d&&e.valAttr("ratio")&&(d=a.formUtils.checkImageRatio(c,e.valAttr("ratio"),h)),d?(j.errorMessage=h.wrongFileDim+" "+e.valAttr("has-not-valid-dim"),b(!1)):b(!0)},function(a){throw a})}else b(!0)},errorMessage:"",errorMessageKey:""}),a(b).one("validatorsLoaded formValidationSetup",function(b,c,d){var e;e=c?c.find('input[type="file"]'):a('input[type="file"]'),a.formUtils.dialogs.removeInputStylingAndMessage(e,d)})}(a,window)}); \ No newline at end of file diff --git a/form-validator/html5.js b/form-validator/html5.js index f143e14..498d3bc 100644 --- a/form-validator/html5.js +++ b/form-validator/html5.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/jquery.form-validator.js b/form-validator/jquery.form-validator.js index 0c2c3c3..b8dee25 100644 --- a/form-validator/jquery.form-validator.js +++ b/form-validator/jquery.form-validator.js @@ -17,7 +17,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT @@ -335,11 +335,13 @@ return $($elem.valAttr('error-msg-container')); } else { var $parent = $elem.parent(); - if (!$parent.hasClass('form-group') && !$parent.closest('form').hasClass('form-horizontal')) { - var $formGroup = $parent.closest('.form-group'); - if ($formGroup.length) { - return $formGroup.eq(0); - } + if($elem.attr('type') === 'checkbox' && $elem.closest('.checkbox').length) { + $parent = $elem.closest('.checkbox').parent(); + } else if($elem.attr('type') === 'radio' && $elem.closest('.radio').length) { + $parent = $elem.closest('.radio').parent(); + } + if($parent.closest('.input-group').length) { + $parent = $parent.closest('.input-group').parent(); } return $parent; } @@ -563,6 +565,10 @@ * * @return {jQuery} */ $.fn.validateOnEvent = function (language, config) { + if(this.length === 0) { + return; + } + var $elements = this[0].nodeName === 'FORM' ? this.find('*[data-validation-event]') : this; $elements .each(function () { @@ -1356,6 +1362,11 @@ */ validators: {}, + /** + * Available sanitizers + */ + sanitizers: {}, + /** * Events triggered by form validator */ @@ -1382,6 +1393,14 @@ this.validators[name] = validator; }, + /** + * Function for adding a sanitizer + * @param {Object} sanitizer + */ + addSanitizer: function (sanitizer) { + this.sanitizers[sanitizer.name] = sanitizer; + }, + /** * Warn user via the console if available */ diff --git a/form-validator/jquery.form-validator.min.js b/form-validator/jquery.form-validator.min.js index 8fdc6d2..c950eef 100644 --- a/form-validator/jquery.form-validator.min.js +++ b/form-validator/jquery.form-validator.min.js @@ -1,10 +1,10 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT */ -!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b,c){function d(a,b){this.$form=a,this.$input=b,this.reset(),b.on("change paste",this.reset.bind(this))}var e=function(){return!1},f=null,g={numHalted:0,haltValidation:function(b){this.numHalted++,a.formUtils.haltValidation=!0,b.unbind("submit",e).bind("submit",e).find('*[type="submit"]').addClass("disabled").attr("disabled","disabled")},unHaltValidation:function(b){this.numHalted--,0===this.numHalted&&(a.formUtils.haltValidation=!1,b.unbind("submit",e).find('*[type="submit"]').removeClass("disabled").removeAttr("disabled","disabled"))}};d.prototype.reset=function(){this.haltedFormValidation=!1,this.hasRun=!1,this.isRunning=!1,this.result=c},d.prototype.run=function(a,b){return"keyup"===a?null:this.isRunning?(f=a,this.haltedFormValidation||(g.haltValidation(),this.haltedFormValidation=!0),null):this.hasRun?this.result:(f=a,g.haltValidation(this.$form),this.haltedFormValidation=!0,this.isRunning=!0,this.$input.attr("disabled","disabled").addClass("async-validation"),this.$form.addClass("async-validation"),b(function(a){this.done(a)}.bind(this)),null)},d.prototype.done=function(a){this.result=a,this.hasRun=!0,this.isRunning=!1,this.$input.removeAttr("disabled").removeClass("async-validation"),this.$form.removeClass("async-validation"),this.haltedFormValidation&&(g.unHaltValidation(this.$form),"submit"===f?this.$form.trigger("submit"):this.$input.trigger("validation.revalidate"))},d.loadInstance=function(a,b,c){var e,f=b.get(0);return f.asyncValidators||(f.asyncValidators={}),f.asyncValidators[a]?e=f.asyncValidators[a]:(e=new d(c,b),f.asyncValidators[a]=e),e},a.formUtils=a.extend(a.formUtils||{},{asyncValidation:function(a,b,c){return this.warn("Use of deprecated function $.formUtils.asyncValidation, use $.formUtils.addAsyncValidator() instead"),d.loadInstance(a,b,c)},addAsyncValidator:function(b){var c=a.extend({},b),e=c.validatorFunction;c.async=!0,c.validatorFunction=function(a,b,f,g,h,i){var j=d.loadInstance(this.name,b,h);return j.run(i,function(d){e.apply(c,[d,a,b,f,g,h,i])})},this.addValidator(c)}}),a(b).bind("validatorsLoaded formValidationSetup",function(b,c){c||(c=a("form")),c.find("[data-validation]").each(function(){var b=a(this);b.valAttr("async",!1),a.each(a.split(b.attr("data-validation")),function(c,d){var e=a.formUtils.validators["validate_"+d];e&&e.async&&b.valAttr("async","yes")})})})}(a,window),function(a,b){"use strict";function c(b){b&&"custom"===b.errorMessagePosition&&"function"==typeof b.errorMessageCustom&&(a.formUtils.warn("Use of deprecated function errorMessageCustom, use config.submitErrorMessageCallback instead"),b.submitErrorMessageCallback=function(a,c){b.errorMessageCustom(a,b.language.errorTitle,c,b)})}function d(b){if(b.errorMessagePosition&&"object"==typeof b.errorMessagePosition){a.formUtils.warn("Deprecated use of config parameter errorMessagePosition, use config.submitErrorMessageCallback instead");var c=b.errorMessagePosition;b.errorMessagePosition="top",b.submitErrorMessageCallback=function(){return c}}}function e(b){var c=b.find("[data-validation-if-checked]");c.length&&a.formUtils.warn('Detected use of attribute "data-validation-if-checked" which is deprecated. Use "data-validation-depends-on" provided by module "logic"'),c.on("beforeValidation",function(){var c=a(this),d=c.valAttr("if-checked"),e=a('input[name="'+d+'"]',b),f=e.is(":checked"),g=(a.formUtils.getValue(e)||"").toString(),h=c.valAttr("if-checked-value");(!f||h&&h!==g)&&c.valAttr("skipped",!0)})}function f(b){var c={se:"sv",cz:"cs",dk:"da"};if(b.lang in c){var d=c[b.lang];a.formUtils.warn('Deprecated use of lang code "'+b.lang+'" use "'+d+'" instead'),b.lang=d}}a.fn.validateForm=function(b,c){return a.formUtils.warn("Use of deprecated function $.validateForm, use $.isValid instead"),this.isValid(b,c,!0)},a(window).on("formValidationPluginInit",function(a,b){f(b),c(b),d(b)}).on("validatorsLoaded formValidationSetup",function(b,c){c||(c=a("form")),e(c)})}(a),function(a){"use strict";var b={resolveErrorMessage:function(a,b,c,d,e){var f=d.validationErrorMsgAttribute+"-"+c.replace("validate_",""),g=a.attr(f);return g||(g=a.attr(d.validationErrorMsgAttribute),g||(g="function"!=typeof b.errorMessageKey?e[b.errorMessageKey]:e[b.errorMessageKey(d)],g||(g=b.errorMessage))),g},getParentContainer:function(b){if(b.valAttr("error-msg-container"))return a(b.valAttr("error-msg-container"));var c=b.parent();if(!c.hasClass("form-group")&&!c.closest("form").hasClass("form-horizontal")){var d=c.closest(".form-group");if(d.length)return d.eq(0)}return c},applyInputErrorStyling:function(a,b){a.addClass(b.errorElementClass).removeClass(b.successElementClass),this.getParentContainer(a).addClass(b.inputParentClassOnError).removeClass(b.inputParentClassOnSuccess),""!==b.borderColorOnError&&a.css("border-color",b.borderColorOnError)},applyInputSuccessStyling:function(a,b){a.addClass(b.successElementClass),this.getParentContainer(a).addClass(b.inputParentClassOnSuccess)},removeInputStylingAndMessage:function(a,c){a.removeClass(c.successElementClass).removeClass(c.errorElementClass).css("border-color","");var d=b.getParentContainer(a);if(d.removeClass(c.inputParentClassOnError).removeClass(c.inputParentClassOnSuccess),"function"==typeof c.inlineErrorMessageCallback){var e=c.inlineErrorMessageCallback(a,!1,c);e&&e.html("")}else d.find("."+c.errorMessageClass).remove()},removeAllMessagesAndStyling:function(c,d){if("function"==typeof d.submitErrorMessageCallback){var e=d.submitErrorMessageCallback(c,!1,d);e&&e.html("")}else c.find("."+d.errorMessageClass+".alert").remove();c.find("."+d.errorElementClass+",."+d.successElementClass).each(function(){b.removeInputStylingAndMessage(a(this),d)})},setInlineMessage:function(b,c,d){this.applyInputErrorStyling(b,d);var e,f=document.getElementById(b.attr("name")+"_err_msg"),g=!1,h=function(d){a.formUtils.$win.trigger("validationErrorDisplay",[b,d]),d.html(c)},i=function(){var f=!1;g.find("."+d.errorMessageClass).each(function(){if(this.inputReferer===b[0])return f=a(this),!1}),f?c?h(f):f.remove():""!==c&&(e=a('
'),h(e),e[0].inputReferer=b[0],g.prepend(e))};if(f)a.formUtils.warn("Using deprecated element reference "+f.id),g=a(f),i();else if("function"==typeof d.inlineErrorMessageCallback){if(g=d.inlineErrorMessageCallback(b,c,d),!g)return;i()}else{var j=this.getParentContainer(b);e=j.find("."+d.errorMessageClass+".help-block"),0===e.length&&(e=a("").addClass("help-block").addClass(d.errorMessageClass),e.appendTo(j)),h(e)}},setMessageInTopOfForm:function(b,c,d,e){var f='
{errorTitle}
    {fields}
',g=!1;if("function"!=typeof d.submitErrorMessageCallback||(g=d.submitErrorMessageCallback(b,c,d))){var h={errorTitle:e.errorTitle,fields:"",errorMessageClass:d.errorMessageClass};a.each(c,function(a,b){h.fields+="
  • "+b+"
  • "}),a.each(h,function(a,b){f=f.replace("{"+a+"}",b)}),g?g.html(f):b.children().eq(0).before(a(f))}}};a.formUtils=a.extend(a.formUtils||{},{dialogs:b})}(a),function(a,b,c){"use strict";var d=0;a.fn.validateOnBlur=function(b,c){var d=this,e=this.find("*[data-validation]");return e.each(function(){var e=a(this);if(e.is("[type=radio]")){var f=d.find('[type=radio][name="'+e.attr("name")+'"]');f.bind("blur.validation",function(){e.validateInputOnBlur(b,c,!0,"blur")}),c.validateCheckboxRadioOnClick&&f.bind("click.validation",function(){e.validateInputOnBlur(b,c,!0,"click")})}}),e.bind("blur.validation",function(){a(this).validateInputOnBlur(b,c,!0,"blur")}),c.validateCheckboxRadioOnClick&&this.find("input[type=checkbox][data-validation],input[type=radio][data-validation]").bind("click.validation",function(){a(this).validateInputOnBlur(b,c,!0,"click")}),this},a.fn.validateOnEvent=function(b,c){var d="FORM"===this[0].nodeName?this.find("*[data-validation-event]"):this;return d.each(function(){var d=a(this),e=d.valAttr("event");e&&d.unbind(e+".validation").bind(e+".validation",function(d){9!==(d||{}).keyCode&&a(this).validateInputOnBlur(b,c,!0,e)})}),this},a.fn.showHelpOnFocus=function(b){return b||(b="data-validation-help"),this.find("textarea,input").each(function(){var c=a(this),e="jquery_form_help_"+ ++d,f=c.attr(b);c.removeClass("has-help-text").unbind("focus.help").unbind("blur.help"),f&&c.addClass("has-help-txt").bind("focus.help",function(){var b=c.parent().find("."+e);0===b.length&&(b=a("").addClass(e).addClass("help").addClass("help-block").text(f).hide(),c.after(b)),b.fadeIn()}).bind("blur.help",function(){a(this).parent().find("."+e).fadeOut("slow")})}),this},a.fn.validate=function(b,c,d){var e=a.extend({},a.formUtils.LANG,d||{});this.each(function(){var d=a(this),f=d.closest("form").get(0)||{},g=f.validationConfig||a.formUtils.defaultConfig();d.one("validation",function(a,c){"function"==typeof b&&b(c,this,a)}),d.validateInputOnBlur(e,a.extend({},g,c||{}),!0)})},a.fn.willPostponeValidation=function(){return(this.valAttr("suggestion-nr")||this.valAttr("postpone")||this.hasClass("hasDatepicker"))&&!b.postponedValidation},a.fn.validateInputOnBlur=function(c,d,e,f){if(a.formUtils.eventType=f,this.willPostponeValidation()){var g=this,h=this.valAttr("postpone")||200;return b.postponedValidation=function(){g.validateInputOnBlur(c,d,e,f),b.postponedValidation=!1},setTimeout(function(){b.postponedValidation&&b.postponedValidation()},h),this}c=a.extend({},a.formUtils.LANG,c||{}),a.formUtils.dialogs.removeInputStylingAndMessage(this,d);var i=this,j=i.closest("form"),k=a.formUtils.validateInput(i,c,d,j,f),l=function(){i.validateInputOnBlur(c,d,!1,"blur.revalidated")};return"blur"===f&&i.unbind("validation.revalidate",l).one("validation.revalidate",l),e&&i.removeKeyUpValidation(),k.shouldChangeDisplay&&(k.isValid?a.formUtils.dialogs.applyInputSuccessStyling(i,d):a.formUtils.dialogs.setInlineMessage(i,k.errorMsg,d)),!k.isValid&&e&&i.validateOnKeyUp(c,d),this},a.fn.validateOnKeyUp=function(b,c){return this.each(function(){var d=a(this);d.valAttr("has-keyup-event")||d.valAttr("has-keyup-event","true").bind("keyup.validation",function(a){9!==a.keyCode&&d.validateInputOnBlur(b,c,!1,"keyup")})}),this},a.fn.removeKeyUpValidation=function(){return this.each(function(){a(this).valAttr("has-keyup-event",!1).unbind("keyup.validation")}),this},a.fn.valAttr=function(a,b){return b===c?this.attr("data-validation-"+a):b===!1||null===b?this.removeAttr("data-validation-"+a):(a=a.length>0?"-"+a:"",this.attr("data-validation"+a,b))},a.fn.isValid=function(b,c,d){if(a.formUtils.isLoadingModules){var e=this;return setTimeout(function(){e.isValid(b,c,d)},200),null}c=a.extend({},a.formUtils.defaultConfig(),c||{}),b=a.extend({},a.formUtils.LANG,b||{}),d=d!==!1,a.formUtils.errorDisplayPreventedWhenHalted&&(delete a.formUtils.errorDisplayPreventedWhenHalted,d=!1);var f=function(b,e){a.inArray(b,h)<0&&h.push(b),i.push(e),e.valAttr("current-error",b),d&&a.formUtils.dialogs.applyInputErrorStyling(e,c)},g=[],h=[],i=[],j=this,k=function(b,d){return"submit"===d||"button"===d||"reset"===d||a.inArray(b,c.ignore||[])>-1};if(d&&a.formUtils.dialogs.removeAllMessagesAndStyling(j,c),j.find("input,textarea,select").filter(':not([type="submit"],[type="button"])').each(function(){var d=a(this),e=d.attr("type"),h="radio"===e||"checkbox"===e,i=d.attr("name");if(!k(i,e)&&(!h||a.inArray(i,g)<0)){h&&g.push(i);var l=a.formUtils.validateInput(d,b,c,j,"submit");l.isValid?l.isValid&&l.shouldChangeDisplay&&(d.valAttr("current-error",!1),a.formUtils.dialogs.applyInputSuccessStyling(d,c)):f(l.errorMsg,d)}}),"function"==typeof c.onValidate){var l=c.onValidate(j);a.isArray(l)?a.each(l,function(a,b){f(b.message,b.element)}):l&&l.element&&l.message&&f(l.message,l.element)}return a.formUtils.isValidatingEntireForm=!1,i.length>0&&d&&("top"===c.errorMessagePosition?a.formUtils.dialogs.setMessageInTopOfForm(j,h,c,b):a.each(i,function(b,d){a.formUtils.dialogs.setInlineMessage(d,d.valAttr("current-error"),c)}),c.scrollToTopOnError&&a.formUtils.$win.scrollTop(j.offset().top-20)),!d&&a.formUtils.haltValidation&&(a.formUtils.errorDisplayPreventedWhenHalted=!0),0===i.length&&!a.formUtils.haltValidation},a.fn.restrictLength=function(b){return new a.formUtils.lengthRestriction(this,b),this},a.fn.addSuggestions=function(b){var c=!1;return this.find("input").each(function(){var d=a(this);c=a.split(d.attr("data-suggestions")),c.length>0&&!d.hasClass("has-suggestions")&&(a.formUtils.suggest(d,c,b),d.addClass("has-suggestions"))}),this}}(a,window),function(a){"use strict";a.formUtils=a.extend(a.formUtils||{},{isLoadingModules:!1,loadedModules:{},registerLoadedModule:function(b){this.loadedModules[a.trim(b).toLowerCase()]=!0},hasLoadedModule:function(b){return a.trim(b).toLowerCase()in this.loadedModules},loadModules:function(b,c,d){if(a.formUtils.isLoadingModules)return void setTimeout(function(){a.formUtils.loadModules(b,c,d)},100);var e=function(b,c){var e=a.split(b),f=e.length,g=function(){f--,0===f&&(a.formUtils.isLoadingModules=!1,"function"==typeof d&&d())};f>0&&(a.formUtils.isLoadingModules=!0);var h="?_="+(new Date).getTime(),i=document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0];a.each(e,function(b,d){if(d=a.trim(d),0===d.length||a.formUtils.hasLoadedModule(d))g();else{var e=c+d+(".js"===d.slice(-3)?"":".js"),f=document.createElement("SCRIPT");"function"==typeof define&&define.amd?require([e+(".dev.js"===e.slice(-7)?h:"")],g):(f.type="text/javascript",f.onload=g,f.src=e+(".dev.js"===e.slice(-7)?h:""),f.onerror=function(){a.formUtils.warn("Unable to load form validation module "+e,!0),g()},f.onreadystatechange=function(){"complete"!==this.readyState&&"loaded"!==this.readyState||(g(),this.onload=null,this.onreadystatechange=null)},i.appendChild(f))}})};if(c)e(b,c);else{var f=function(){var c=!1;return a('script[src*="form-validator"]').each(function(){var a=this.src.split("form-validator")[1].split("node_modules").length>1;if(!a)return c=this.src.substr(0,this.src.lastIndexOf("/"))+"/","/"===c&&(c=""),!1}),c!==!1&&(e(b,c),!0)};f()||a(function(){var a=f();a||"function"==typeof d&&d()})}}})}(a),function(a){"use strict";a.split=function(b,c,d){d=void 0===d||d===!0;var e="[,|"+(d?"\\s":"")+"-]\\s*",f=new RegExp(e,"g");if("function"!=typeof c){if(!b)return[];var g=[];return a.each(b.split(c?c:f),function(b,c){c=a.trim(c),c.length&&g.push(c)}),g}b&&a.each(b.split(f),function(b,d){if(d=a.trim(d),d.length)return c(d,b)})},a.validate=function(b){var c=a.extend(a.formUtils.defaultConfig(),{form:"form",validateOnEvent:!1,validateOnBlur:!0,validateCheckboxRadioOnClick:!0,showHelpOnFocus:!0,addSuggestions:!0,modules:"",onModulesLoaded:null,language:!1,onSuccess:!1,onError:!1,onElementValidate:!1});if(b=a.extend(c,b||{}),a(window).trigger("formValidationPluginInit",[b]),b.lang&&"en"!==b.lang){var d="lang/"+b.lang+".js";b.modules+=b.modules.length?","+d:d}a(b.form).each(function(c,d){d.validationConfig=b;var e=a(d);e.trigger("formValidationSetup",[e,b]),e.find(".has-help-txt").unbind("focus.validation").unbind("blur.validation"),e.removeClass("has-validation-callback").unbind("submit.validation").unbind("reset.validation").find("input[data-validation],textarea[data-validation]").unbind("blur.validation"),e.bind("submit.validation",function(c){var d=a(this),e=function(){return c.stopImmediatePropagation(),!1};if(a.formUtils.haltValidation)return e();if(a.formUtils.isLoadingModules)return setTimeout(function(){d.trigger("submit.validation")},200),e();var f=d.isValid(b.language,b);if(a.formUtils.haltValidation)return e();if(!f||"function"!=typeof b.onSuccess)return f||"function"!=typeof b.onError?!!f||e():(b.onError(d),e());var g=b.onSuccess(d);return g===!1?e():void 0}).bind("reset.validation",function(){a.formUtils.dialogs.removeAllMessagesAndStyling(e,b)}).addClass("has-validation-callback"),b.showHelpOnFocus&&e.showHelpOnFocus(),b.addSuggestions&&e.addSuggestions(),b.validateOnBlur&&(e.validateOnBlur(b.language,b),e.bind("html5ValidationAttrsFound",function(){e.validateOnBlur(b.language,b)})),b.validateOnEvent&&e.validateOnEvent(b.language,b)}),""!==b.modules&&a.formUtils.loadModules(b.modules,null,function(){"function"==typeof b.onModulesLoaded&&b.onModulesLoaded();var c="string"==typeof b.form?a(b.form):b.form;a.formUtils.$win.trigger("validatorsLoaded",[c,b])})}}(a),function(a,b){"use strict";var c=a(b);a.formUtils=a.extend(a.formUtils||{},{$win:c,defaultConfig:function(){return{ignore:[],errorElementClass:"error",successElementClass:"valid",borderColorOnError:"#b94a48",errorMessageClass:"form-error",validationRuleAttribute:"data-validation",validationErrorMsgAttribute:"data-validation-error-msg",errorMessagePosition:"inline",errorMessageTemplate:{container:'
    {messages}
    ',messages:"{errorTitle}
      {fields}
    ",field:"
  • {msg}
  • "},scrollToTopOnError:!0,dateFormat:"yyyy-mm-dd",addValidClassOnAll:!1,decimalSeparator:".",inputParentClassOnError:"has-error",inputParentClassOnSuccess:"has-success",validateHiddenInputs:!1,inlineErrorMessageCallback:!1,submitErrorMessageCallback:!1}},validators:{},_events:{load:[],valid:[],invalid:[]},haltValidation:!1,addValidator:function(a){var b=0===a.name.indexOf("validate_")?a.name:"validate_"+a.name;void 0===a.validateOnKeyUp&&(a.validateOnKeyUp=!0),this.validators[b]=a},warn:function(a,c){"console"in b?"function"==typeof b.console.warn?b.console.warn(a):"function"==typeof b.console.log&&b.console.log(a):c&&alert(a)},getValue:function(a,b){var c=b?b.find(a):a;if(c.length>0){var d=c.eq(0).attr("type");return"radio"===d||"checkbox"===d?c.filter(":checked").val()||"":c.val()||""}return!1},validateInput:function(b,c,d,e,f){d=d||a.formUtils.defaultConfig(),c=c||a.formUtils.LANG,e.length||(e=b.parent());var g=this.getValue(b);b.valAttr("skipped",!1).one("beforeValidation",function(){(b.attr("disabled")||!b.is(":visible")&&!d.validateHiddenInputs)&&b.valAttr("skipped",1)}).trigger("beforeValidation",[g,c,d]);var h="true"===b.valAttr("optional"),i=!g&&h,j=b.attr(d.validationRuleAttribute),k=!0,l="",m={isValid:!0,shouldChangeDisplay:!0,errorMsg:""};if(!j||i||b.valAttr("skipped"))return m.shouldChangeDisplay=d.addValidClassOnAll,m;var n=b.valAttr("ignore");return n&&a.each(n.split(""),function(a,b){g=g.replace(new RegExp("\\"+b,"g"),"")}),a.split(j,function(h){0!==h.indexOf("validate_")&&(h="validate_"+h);var i=a.formUtils.validators[h];if(!i)throw new Error('Using undefined validator "'+h+'". Maybe you have forgotten to load the module that "'+h+'" belongs to?');if("validate_checkbox_group"===h&&(b=e.find('[name="'+b.attr("name")+'"]:eq(0)')),("keyup"!==f||i.validateOnKeyUp)&&(k=i.validatorFunction(g,b,d,c,e,f)),!k)return d.validateOnBlur&&b.validateOnKeyUp(c,d),l=a.formUtils.dialogs.resolveErrorMessage(b,i,h,d,c),!1}),k===!1?(b.trigger("validation",!1),m.errorMsg=l,m.isValid=!1,m.shouldChangeDisplay=!0):null===k?m.shouldChangeDisplay=!1:(b.trigger("validation",!0),m.shouldChangeDisplay=!0),"function"==typeof d.onElementValidate&&null!==l&&d.onElementValidate(m.isValid,b,e,l),b.trigger("afterValidation",[m,f]),m},parseDate:function(b,c,d){var e,f,g,h,i=c.replace(/[a-zA-Z]/gi,"").substring(0,1),j="^",k=c.split(i||null);if(a.each(k,function(a,b){j+=(a>0?"\\"+i:"")+"(\\d{"+b.length+"})"}),j+="$",d){var l=[];a.each(b.split(i),function(a,b){1===b.length&&(b="0"+b),l.push(b)}),b=l.join(i)}if(e=b.match(new RegExp(j)),null===e)return!1;var m=function(b,c,d){for(var e=0;e28&&(h%4!==0||h%100===0&&h%400!==0)||2===g&&f>29&&(h%4===0||h%100!==0&&h%400===0)||g>12||0===g)&&(!(this.isShortMonth(g)&&f>30||!this.isShortMonth(g)&&f>31||0===f)&&[h,g,f])},parseDateInt:function(a){return 0===a.indexOf("0")&&(a=a.replace("0","")),parseInt(a,10)},isShortMonth:function(a){return a%2===0&&a<7||a%2!==0&&a>7},lengthRestriction:function(b,c){var d=parseInt(c.text(),10),e=0,f=function(){var a=b.val().length;if(a>d){var f=b.scrollTop();b.val(b.val().substring(0,d)),b.scrollTop(f)}e=d-a,e<0&&(e=0),c.text(e)};a(b).bind("keydown keyup keypress focus blur",f).bind("cut paste",function(){setTimeout(f,100)}),a(document).bind("ready",f)},numericRangeCheck:function(b,c){var d=a.split(c),e=parseInt(c.substr(3),10);return 1===d.length&&c.indexOf("min")===-1&&c.indexOf("max")===-1&&(d=[c,c]),2===d.length&&(bparseInt(d[1],10))?["out",d[0],d[1]]:0===c.indexOf("min")&&be?["max",e]:["ok"]},_numSuggestionElements:0,_selectedSuggestion:null,_previousTypedVal:null,suggest:function(b,d,e){var f={css:{maxHeight:"150px",background:"#FFF",lineHeight:"150%",textDecoration:"underline",overflowX:"hidden",overflowY:"auto",border:"#CCC solid 1px",borderTop:"none",cursor:"pointer"},activeSuggestionCSS:{background:"#E9E9E9"}},g=function(a,b){var c=b.offset();a.css({width:b.outerWidth(),left:c.left+"px",top:c.top+b.outerHeight()+"px"})};e&&a.extend(f,e),f.css.position="absolute",f.css["z-index"]=9999,b.attr("autocomplete","off"),0===this._numSuggestionElements&&c.bind("resize",function(){a(".jquery-form-suggestions").each(function(){var b=a(this),c=b.attr("data-suggest-container");g(b,a(".suggestions-"+c).eq(0))})}),this._numSuggestionElements++;var h=function(b){var c=b.valAttr("suggestion-nr");a.formUtils._selectedSuggestion=null,a.formUtils._previousTypedVal=null,a(".jquery-form-suggestion-"+c).fadeOut("fast")};return b.data("suggestions",d).valAttr("suggestion-nr",this._numSuggestionElements).unbind("focus.suggest").bind("focus.suggest",function(){a(this).trigger("keyup"),a.formUtils._selectedSuggestion=null}).unbind("keyup.suggest").bind("keyup.suggest",function(){var c=a(this),d=[],e=a.trim(c.val()).toLocaleLowerCase();if(e!==a.formUtils._previousTypedVal){a.formUtils._previousTypedVal=e;var i=!1,j=c.valAttr("suggestion-nr"),k=a(".jquery-form-suggestion-"+j);if(k.scrollTop(0),""!==e){var l=e.length>2;a.each(c.data("suggestions"),function(a,b){var c=b.toLocaleLowerCase();return c===e?(d.push(""+b+""),i=!0,!1):void((0===c.indexOf(e)||l&&c.indexOf(e)>-1)&&d.push(b.replace(new RegExp(e,"gi"),"$&")))})}i||0===d.length&&k.length>0?k.hide():d.length>0&&0===k.length?(k=a("
    ").css(f.css).appendTo("body"),b.addClass("suggestions-"+j),k.attr("data-suggest-container",j).addClass("jquery-form-suggestions").addClass("jquery-form-suggestion-"+j)):d.length>0&&!k.is(":visible")&&k.show(),d.length>0&&e.length!==d[0].length&&(g(k,c),k.html(""),a.each(d,function(b,d){a("
    ").append(d).css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"5px"}).addClass("form-suggest-element").appendTo(k).click(function(){c.focus(),c.val(a(this).text()),c.trigger("change"),h(c)})}))}}).unbind("keydown.validation").bind("keydown.validation",function(b){var c,d,e=b.keyCode?b.keyCode:b.which,g=a(this);if(13===e&&null!==a.formUtils._selectedSuggestion){if(c=g.valAttr("suggestion-nr"),d=a(".jquery-form-suggestion-"+c),d.length>0){var i=d.find("div").eq(a.formUtils._selectedSuggestion).text();g.val(i),g.trigger("change"),h(g),b.preventDefault()}}else{c=g.valAttr("suggestion-nr"),d=a(".jquery-form-suggestion-"+c);var j=d.children();if(j.length>0&&a.inArray(e,[38,40])>-1){38===e?(null===a.formUtils._selectedSuggestion?a.formUtils._selectedSuggestion=j.length-1:a.formUtils._selectedSuggestion--,a.formUtils._selectedSuggestion<0&&(a.formUtils._selectedSuggestion=j.length-1)):40===e&&(null===a.formUtils._selectedSuggestion?a.formUtils._selectedSuggestion=0:a.formUtils._selectedSuggestion++,a.formUtils._selectedSuggestion>j.length-1&&(a.formUtils._selectedSuggestion=0));var k=d.innerHeight(),l=d.scrollTop(),m=d.children().eq(0).outerHeight(),n=m*a.formUtils._selectedSuggestion;return(nl+k)&&d.scrollTop(n),j.removeClass("active-suggestion").css("background","none").eq(a.formUtils._selectedSuggestion).addClass("active-suggestion").css(f.activeSuggestionCSS),b.preventDefault(),!1}}}).unbind("blur.suggest").bind("blur.suggest",function(){h(a(this))}),b},LANG:{errorTitle:"Form submission failed!",requiredField:"This is a required field",requiredFields:"You have not answered all required fields",badTime:"You have not given a correct time",badEmail:"You have not given a correct e-mail address",badTelephone:"You have not given a correct phone number",badSecurityAnswer:"You have not given a correct answer to the security question",badDate:"You have not given a correct date",lengthBadStart:"The input value must be between ",lengthBadEnd:" characters",lengthTooLongStart:"The input value is longer than ",lengthTooShortStart:"The input value is shorter than ",notConfirmed:"Input values could not be confirmed",badDomain:"Incorrect domain value",badUrl:"The input value is not a correct URL",badCustomVal:"The input value is incorrect",andSpaces:" and spaces ",badInt:"The input value was not a correct number",badSecurityNumber:"Your social security number was incorrect",badUKVatAnswer:"Incorrect UK VAT Number",badUKNin:"Incorrect UK NIN",badUKUtr:"Incorrect UK UTR Number",badStrength:"The password isn't strong enough",badNumberOfSelectedOptionsStart:"You have to choose at least ",badNumberOfSelectedOptionsEnd:" answers",badAlphaNumeric:"The input value can only contain alphanumeric characters ",badAlphaNumericExtra:" and ",wrongFileSize:"The file you are trying to upload is too large (max %s)",wrongFileType:"Only files of type %s is allowed",groupCheckedRangeStart:"Please choose between ",groupCheckedTooFewStart:"Please choose at least ",groupCheckedTooManyStart:"Please choose a maximum of ",groupCheckedEnd:" item(s)",badCreditCard:"The credit card number is not correct",badCVV:"The CVV number was not correct",wrongFileDim:"Incorrect image dimensions,",imageTooTall:"the image can not be taller than",imageTooWide:"the image can not be wider than",imageTooSmall:"the image was too small",min:"min",max:"max",imageRatioNotAccepted:"Image ratio is not be accepted",badBrazilTelephoneAnswer:"The phone number entered is invalid",badBrazilCEPAnswer:"The CEP entered is invalid",badBrazilCPFAnswer:"The CPF entered is invalid",badPlPesel:"The PESEL entered is invalid",badPlNip:"The NIP entered is invalid",badPlRegon:"The REGON entered is invalid",badreCaptcha:"Please confirm that you are not a bot",passwordComplexityStart:"Password must contain at least ",passwordComplexitySeparator:", ",passwordComplexityUppercaseInfo:" uppercase letter(s)",passwordComplexityLowercaseInfo:" lowercase letter(s)",passwordComplexitySpecialCharsInfo:" special character(s)",passwordComplexityNumericCharsInfo:" numeric character(s)",passwordComplexityEnd:"."}})}(a,window),function(a){a.formUtils.addValidator({name:"email",validatorFunction:function(b){var c=b.toLowerCase().split("@"),d=c[0],e=c[1];if(d&&e){if(0===d.indexOf('"')){var f=d.length;if(d=d.replace(/\"/g,""),d.length!==f-2)return!1}return a.formUtils.validators.validate_domain.validatorFunction(c[1])&&0!==d.indexOf(".")&&"."!==d.substring(d.length-1,d.length)&&d.indexOf("..")===-1&&!/[^\w\+\.\-\#\-\_\~\!\$\&\'\(\)\*\+\,\;\=\:]/.test(d)}return!1},errorMessage:"",errorMessageKey:"badEmail"}),a.formUtils.addValidator({name:"domain",validatorFunction:function(a){return a.length>0&&a.length<=253&&!/[^a-zA-Z0-9]/.test(a.slice(-2))&&!/[^a-zA-Z0-9]/.test(a.substr(0,1))&&!/[^a-zA-Z0-9\.\-]/.test(a)&&1===a.split("..").length&&a.split(".").length>1},errorMessage:"",errorMessageKey:"badDomain"}),a.formUtils.addValidator({name:"required",validatorFunction:function(b,c,d,e,f){switch(c.attr("type")){case"checkbox":return c.is(":checked");case"radio":return f.find('input[name="'+c.attr("name")+'"]').filter(":checked").length>0;default:return""!==a.trim(b)}},errorMessage:"",errorMessageKey:function(a){return"top"===a.errorMessagePosition||"function"==typeof a.errorMessagePosition?"requiredFields":"requiredField"}}),a.formUtils.addValidator({name:"length",validatorFunction:function(b,c,d,e){var f=c.valAttr("length"),g=c.attr("type");if(void 0===f)return alert('Please add attribute "data-validation-length" to '+c[0].nodeName+" named "+c.attr("name")),!0;var h,i="file"===g&&void 0!==c.get(0).files?c.get(0).files.length:b.length,j=a.formUtils.numericRangeCheck(i,f);switch(j[0]){case"out":this.errorMessage=e.lengthBadStart+f+e.lengthBadEnd,h=!1;break;case"min":this.errorMessage=e.lengthTooShortStart+j[1]+e.lengthBadEnd,h=!1;break;case"max":this.errorMessage=e.lengthTooLongStart+j[1]+e.lengthBadEnd,h=!1;break;default:h=!0}return h},errorMessage:"",errorMessageKey:""}),a.formUtils.addValidator({name:"url",validatorFunction:function(b){var c=/^(https?|ftp):\/\/((((\w|-|\.|~|[\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])(\w|-|\.|~|[\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])(\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|\[|\]|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;if(c.test(b)){var d=b.split("://")[1],e=d.indexOf("/");return e>-1&&(d=d.substr(0,e)),a.formUtils.validators.validate_domain.validatorFunction(d)}return!1},errorMessage:"",errorMessageKey:"badUrl"}),a.formUtils.addValidator({name:"number",validatorFunction:function(a,b,c){if(""!==a){var d,e,f=b.valAttr("allowing")||"",g=b.valAttr("decimal-separator")||c.decimalSeparator,h=!1,i=b.valAttr("step")||"",j=!1,k=b.attr("data-sanitize")||"",l=k.match(/(^|[\s])numberFormat([\s]|$)/i);if(l){if(!window.numeral)throw new ReferenceError("The data-sanitize value numberFormat cannot be used without the numeral library. Please see Data Validation in http://www.formvalidator.net for more information.");a.length&&(a=String(numeral().unformat(a)))}if(f.indexOf("number")===-1&&(f+=",number"),f.indexOf("negative")===-1&&0===a.indexOf("-"))return!1;if(f.indexOf("range")>-1&&(d=parseFloat(f.substring(f.indexOf("[")+1,f.indexOf(";"))),e=parseFloat(f.substring(f.indexOf(";")+1,f.indexOf("]"))),h=!0),""!==i&&(j=!0),","===g){if(a.indexOf(".")>-1)return!1;a=a.replace(",",".")}if(""===a.replace(/[0-9-]/g,"")&&(!h||a>=d&&a<=e)&&(!j||a%i===0))return!0;if(f.indexOf("float")>-1&&null!==a.match(new RegExp("^([0-9-]+)\\.([0-9]+)$"))&&(!h||a>=d&&a<=e)&&(!j||a%i===0))return!0}return!1},errorMessage:"",errorMessageKey:"badInt"}),a.formUtils.addValidator({name:"alphanumeric",validatorFunction:function(b,c,d,e){var f="^([a-zA-Z0-9",g="]+)$",h=c.valAttr("allowing"),i="",j=!1;if(h){i=f+h+g;var k=h.replace(/\\/g,"");k.indexOf(" ")>-1&&(j=!0,k=k.replace(" ",""),k+=e.andSpaces||a.formUtils.LANG.andSpaces),e.badAlphaNumericAndExtraAndSpaces&&e.badAlphaNumericAndExtra?j?this.errorMessage=e.badAlphaNumericAndExtraAndSpaces+k:this.errorMessage=e.badAlphaNumericAndExtra+k+e.badAlphaNumericExtra:this.errorMessage=e.badAlphaNumeric+e.badAlphaNumericExtra+k}else i=f+g,this.errorMessage=e.badAlphaNumeric;return new RegExp(i).test(b)},errorMessage:"",errorMessageKey:""}),a.formUtils.addValidator({ -name:"custom",validatorFunction:function(a,b){var c=new RegExp(b.valAttr("regexp"));return c.test(a)},errorMessage:"",errorMessageKey:"badCustomVal"}),a.formUtils.addValidator({name:"date",validatorFunction:function(b,c,d){var e=c.valAttr("format")||d.dateFormat||"yyyy-mm-dd",f="false"===c.valAttr("require-leading-zero");return a.formUtils.parseDate(b,e,f)!==!1},errorMessage:"",errorMessageKey:"badDate"}),a.formUtils.addValidator({name:"checkbox_group",validatorFunction:function(b,c,d,e,f){var g=!0,h=c.attr("name"),i=a('input[type=checkbox][name^="'+h+'"]',f),j=i.filter(":checked").length,k=c.valAttr("qty");if(void 0===k){var l=c.get(0).nodeName;alert('Attribute "data-validation-qty" is missing from '+l+" named "+c.attr("name"))}var m=a.formUtils.numericRangeCheck(j,k);switch(m[0]){case"out":this.errorMessage=e.groupCheckedRangeStart+k+e.groupCheckedEnd,g=!1;break;case"min":this.errorMessage=e.groupCheckedTooFewStart+m[1]+(e.groupCheckedTooFewEnd||e.groupCheckedEnd),g=!1;break;case"max":this.errorMessage=e.groupCheckedTooManyStart+m[1]+(e.groupCheckedTooManyEnd||e.groupCheckedEnd),g=!1;break;default:g=!0}if(!g){var n=function(){i.unbind("click",n),i.filter("*[data-validation]").validateInputOnBlur(e,d,!1,"blur")};i.bind("click",n)}return g}})}(a)}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b,c){function d(a,b){this.$form=a,this.$input=b,this.reset(),b.on("change paste",this.reset.bind(this))}var e=function(){return!1},f=null,g={numHalted:0,haltValidation:function(b){this.numHalted++,a.formUtils.haltValidation=!0,b.unbind("submit",e).bind("submit",e).find('*[type="submit"]').addClass("disabled").attr("disabled","disabled")},unHaltValidation:function(b){this.numHalted--,0===this.numHalted&&(a.formUtils.haltValidation=!1,b.unbind("submit",e).find('*[type="submit"]').removeClass("disabled").removeAttr("disabled","disabled"))}};d.prototype.reset=function(){this.haltedFormValidation=!1,this.hasRun=!1,this.isRunning=!1,this.result=c},d.prototype.run=function(a,b){return"keyup"===a?null:this.isRunning?(f=a,this.haltedFormValidation||(g.haltValidation(),this.haltedFormValidation=!0),null):this.hasRun?this.result:(f=a,g.haltValidation(this.$form),this.haltedFormValidation=!0,this.isRunning=!0,this.$input.attr("disabled","disabled").addClass("async-validation"),this.$form.addClass("async-validation"),b(function(a){this.done(a)}.bind(this)),null)},d.prototype.done=function(a){this.result=a,this.hasRun=!0,this.isRunning=!1,this.$input.removeAttr("disabled").removeClass("async-validation"),this.$form.removeClass("async-validation"),this.haltedFormValidation&&(g.unHaltValidation(this.$form),"submit"===f?this.$form.trigger("submit"):this.$input.trigger("validation.revalidate"))},d.loadInstance=function(a,b,c){var e,f=b.get(0);return f.asyncValidators||(f.asyncValidators={}),f.asyncValidators[a]?e=f.asyncValidators[a]:(e=new d(c,b),f.asyncValidators[a]=e),e},a.formUtils=a.extend(a.formUtils||{},{asyncValidation:function(a,b,c){return this.warn("Use of deprecated function $.formUtils.asyncValidation, use $.formUtils.addAsyncValidator() instead"),d.loadInstance(a,b,c)},addAsyncValidator:function(b){var c=a.extend({},b),e=c.validatorFunction;c.async=!0,c.validatorFunction=function(a,b,f,g,h,i){var j=d.loadInstance(this.name,b,h);return j.run(i,function(d){e.apply(c,[d,a,b,f,g,h,i])})},this.addValidator(c)}}),a(b).bind("validatorsLoaded formValidationSetup",function(b,c){c||(c=a("form")),c.find("[data-validation]").each(function(){var b=a(this);b.valAttr("async",!1),a.each(a.split(b.attr("data-validation")),function(c,d){var e=a.formUtils.validators["validate_"+d];e&&e.async&&b.valAttr("async","yes")})})})}(a,window),function(a,b){"use strict";function c(b){b&&"custom"===b.errorMessagePosition&&"function"==typeof b.errorMessageCustom&&(a.formUtils.warn("Use of deprecated function errorMessageCustom, use config.submitErrorMessageCallback instead"),b.submitErrorMessageCallback=function(a,c){b.errorMessageCustom(a,b.language.errorTitle,c,b)})}function d(b){if(b.errorMessagePosition&&"object"==typeof b.errorMessagePosition){a.formUtils.warn("Deprecated use of config parameter errorMessagePosition, use config.submitErrorMessageCallback instead");var c=b.errorMessagePosition;b.errorMessagePosition="top",b.submitErrorMessageCallback=function(){return c}}}function e(b){var c=b.find("[data-validation-if-checked]");c.length&&a.formUtils.warn('Detected use of attribute "data-validation-if-checked" which is deprecated. Use "data-validation-depends-on" provided by module "logic"'),c.on("beforeValidation",function(){var c=a(this),d=c.valAttr("if-checked"),e=a('input[name="'+d+'"]',b),f=e.is(":checked"),g=(a.formUtils.getValue(e)||"").toString(),h=c.valAttr("if-checked-value");(!f||h&&h!==g)&&c.valAttr("skipped",!0)})}function f(b){var c={se:"sv",cz:"cs",dk:"da"};if(b.lang in c){var d=c[b.lang];a.formUtils.warn('Deprecated use of lang code "'+b.lang+'" use "'+d+'" instead'),b.lang=d}}a.fn.validateForm=function(b,c){return a.formUtils.warn("Use of deprecated function $.validateForm, use $.isValid instead"),this.isValid(b,c,!0)},a(window).on("formValidationPluginInit",function(a,b){f(b),c(b),d(b)}).on("validatorsLoaded formValidationSetup",function(b,c){c||(c=a("form")),e(c)})}(a),function(a){"use strict";var b={resolveErrorMessage:function(a,b,c,d,e){var f=d.validationErrorMsgAttribute+"-"+c.replace("validate_",""),g=a.attr(f);return g||(g=a.attr(d.validationErrorMsgAttribute),g||(g="function"!=typeof b.errorMessageKey?e[b.errorMessageKey]:e[b.errorMessageKey(d)],g||(g=b.errorMessage))),g},getParentContainer:function(b){if(b.valAttr("error-msg-container"))return a(b.valAttr("error-msg-container"));var c=b.parent();return"checkbox"===b.attr("type")&&b.closest(".checkbox").length?c=b.closest(".checkbox").parent():"radio"===b.attr("type")&&b.closest(".radio").length&&(c=b.closest(".radio").parent()),c.closest(".input-group").length&&(c=c.closest(".input-group").parent()),c},applyInputErrorStyling:function(a,b){a.addClass(b.errorElementClass).removeClass(b.successElementClass),this.getParentContainer(a).addClass(b.inputParentClassOnError).removeClass(b.inputParentClassOnSuccess),""!==b.borderColorOnError&&a.css("border-color",b.borderColorOnError)},applyInputSuccessStyling:function(a,b){a.addClass(b.successElementClass),this.getParentContainer(a).addClass(b.inputParentClassOnSuccess)},removeInputStylingAndMessage:function(a,c){a.removeClass(c.successElementClass).removeClass(c.errorElementClass).css("border-color","");var d=b.getParentContainer(a);if(d.removeClass(c.inputParentClassOnError).removeClass(c.inputParentClassOnSuccess),"function"==typeof c.inlineErrorMessageCallback){var e=c.inlineErrorMessageCallback(a,!1,c);e&&e.html("")}else d.find("."+c.errorMessageClass).remove()},removeAllMessagesAndStyling:function(c,d){if("function"==typeof d.submitErrorMessageCallback){var e=d.submitErrorMessageCallback(c,!1,d);e&&e.html("")}else c.find("."+d.errorMessageClass+".alert").remove();c.find("."+d.errorElementClass+",."+d.successElementClass).each(function(){b.removeInputStylingAndMessage(a(this),d)})},setInlineMessage:function(b,c,d){this.applyInputErrorStyling(b,d);var e,f=document.getElementById(b.attr("name")+"_err_msg"),g=!1,h=function(d){a.formUtils.$win.trigger("validationErrorDisplay",[b,d]),d.html(c)},i=function(){var f=!1;g.find("."+d.errorMessageClass).each(function(){if(this.inputReferer===b[0])return f=a(this),!1}),f?c?h(f):f.remove():""!==c&&(e=a('
    '),h(e),e[0].inputReferer=b[0],g.prepend(e))};if(f)a.formUtils.warn("Using deprecated element reference "+f.id),g=a(f),i();else if("function"==typeof d.inlineErrorMessageCallback){if(g=d.inlineErrorMessageCallback(b,c,d),!g)return;i()}else{var j=this.getParentContainer(b);e=j.find("."+d.errorMessageClass+".help-block"),0===e.length&&(e=a("").addClass("help-block").addClass(d.errorMessageClass),e.appendTo(j)),h(e)}},setMessageInTopOfForm:function(b,c,d,e){var f='
    {errorTitle}
      {fields}
    ',g=!1;if("function"!=typeof d.submitErrorMessageCallback||(g=d.submitErrorMessageCallback(b,c,d))){var h={errorTitle:e.errorTitle,fields:"",errorMessageClass:d.errorMessageClass};a.each(c,function(a,b){h.fields+="
  • "+b+"
  • "}),a.each(h,function(a,b){f=f.replace("{"+a+"}",b)}),g?g.html(f):b.children().eq(0).before(a(f))}}};a.formUtils=a.extend(a.formUtils||{},{dialogs:b})}(a),function(a,b,c){"use strict";var d=0;a.fn.validateOnBlur=function(b,c){var d=this,e=this.find("*[data-validation]");return e.each(function(){var e=a(this);if(e.is("[type=radio]")){var f=d.find('[type=radio][name="'+e.attr("name")+'"]');f.bind("blur.validation",function(){e.validateInputOnBlur(b,c,!0,"blur")}),c.validateCheckboxRadioOnClick&&f.bind("click.validation",function(){e.validateInputOnBlur(b,c,!0,"click")})}}),e.bind("blur.validation",function(){a(this).validateInputOnBlur(b,c,!0,"blur")}),c.validateCheckboxRadioOnClick&&this.find("input[type=checkbox][data-validation],input[type=radio][data-validation]").bind("click.validation",function(){a(this).validateInputOnBlur(b,c,!0,"click")}),this},a.fn.validateOnEvent=function(b,c){if(0!==this.length){var d="FORM"===this[0].nodeName?this.find("*[data-validation-event]"):this;return d.each(function(){var d=a(this),e=d.valAttr("event");e&&d.unbind(e+".validation").bind(e+".validation",function(d){9!==(d||{}).keyCode&&a(this).validateInputOnBlur(b,c,!0,e)})}),this}},a.fn.showHelpOnFocus=function(b){return b||(b="data-validation-help"),this.find("textarea,input").each(function(){var c=a(this),e="jquery_form_help_"+ ++d,f=c.attr(b);c.removeClass("has-help-text").unbind("focus.help").unbind("blur.help"),f&&c.addClass("has-help-txt").bind("focus.help",function(){var b=c.parent().find("."+e);0===b.length&&(b=a("").addClass(e).addClass("help").addClass("help-block").text(f).hide(),c.after(b)),b.fadeIn()}).bind("blur.help",function(){a(this).parent().find("."+e).fadeOut("slow")})}),this},a.fn.validate=function(b,c,d){var e=a.extend({},a.formUtils.LANG,d||{});this.each(function(){var d=a(this),f=d.closest("form").get(0)||{},g=f.validationConfig||a.formUtils.defaultConfig();d.one("validation",function(a,c){"function"==typeof b&&b(c,this,a)}),d.validateInputOnBlur(e,a.extend({},g,c||{}),!0)})},a.fn.willPostponeValidation=function(){return(this.valAttr("suggestion-nr")||this.valAttr("postpone")||this.hasClass("hasDatepicker"))&&!b.postponedValidation},a.fn.validateInputOnBlur=function(c,d,e,f){if(a.formUtils.eventType=f,this.willPostponeValidation()){var g=this,h=this.valAttr("postpone")||200;return b.postponedValidation=function(){g.validateInputOnBlur(c,d,e,f),b.postponedValidation=!1},setTimeout(function(){b.postponedValidation&&b.postponedValidation()},h),this}c=a.extend({},a.formUtils.LANG,c||{}),a.formUtils.dialogs.removeInputStylingAndMessage(this,d);var i=this,j=i.closest("form"),k=a.formUtils.validateInput(i,c,d,j,f),l=function(){i.validateInputOnBlur(c,d,!1,"blur.revalidated")};return"blur"===f&&i.unbind("validation.revalidate",l).one("validation.revalidate",l),e&&i.removeKeyUpValidation(),k.shouldChangeDisplay&&(k.isValid?a.formUtils.dialogs.applyInputSuccessStyling(i,d):a.formUtils.dialogs.setInlineMessage(i,k.errorMsg,d)),!k.isValid&&e&&i.validateOnKeyUp(c,d),this},a.fn.validateOnKeyUp=function(b,c){return this.each(function(){var d=a(this);d.valAttr("has-keyup-event")||d.valAttr("has-keyup-event","true").bind("keyup.validation",function(a){9!==a.keyCode&&d.validateInputOnBlur(b,c,!1,"keyup")})}),this},a.fn.removeKeyUpValidation=function(){return this.each(function(){a(this).valAttr("has-keyup-event",!1).unbind("keyup.validation")}),this},a.fn.valAttr=function(a,b){return b===c?this.attr("data-validation-"+a):b===!1||null===b?this.removeAttr("data-validation-"+a):(a=a.length>0?"-"+a:"",this.attr("data-validation"+a,b))},a.fn.isValid=function(b,c,d){if(a.formUtils.isLoadingModules){var e=this;return setTimeout(function(){e.isValid(b,c,d)},200),null}c=a.extend({},a.formUtils.defaultConfig(),c||{}),b=a.extend({},a.formUtils.LANG,b||{}),d=d!==!1,a.formUtils.errorDisplayPreventedWhenHalted&&(delete a.formUtils.errorDisplayPreventedWhenHalted,d=!1);var f=function(b,e){a.inArray(b,h)<0&&h.push(b),i.push(e),e.valAttr("current-error",b),d&&a.formUtils.dialogs.applyInputErrorStyling(e,c)},g=[],h=[],i=[],j=this,k=function(b,d){return"submit"===d||"button"===d||"reset"===d||a.inArray(b,c.ignore||[])>-1};if(d&&a.formUtils.dialogs.removeAllMessagesAndStyling(j,c),j.find("input,textarea,select").filter(':not([type="submit"],[type="button"])').each(function(){var d=a(this),e=d.attr("type"),h="radio"===e||"checkbox"===e,i=d.attr("name");if(!k(i,e)&&(!h||a.inArray(i,g)<0)){h&&g.push(i);var l=a.formUtils.validateInput(d,b,c,j,"submit");l.isValid?l.isValid&&l.shouldChangeDisplay&&(d.valAttr("current-error",!1),a.formUtils.dialogs.applyInputSuccessStyling(d,c)):f(l.errorMsg,d)}}),"function"==typeof c.onValidate){var l=c.onValidate(j);a.isArray(l)?a.each(l,function(a,b){f(b.message,b.element)}):l&&l.element&&l.message&&f(l.message,l.element)}return a.formUtils.isValidatingEntireForm=!1,i.length>0&&d&&("top"===c.errorMessagePosition?a.formUtils.dialogs.setMessageInTopOfForm(j,h,c,b):a.each(i,function(b,d){a.formUtils.dialogs.setInlineMessage(d,d.valAttr("current-error"),c)}),c.scrollToTopOnError&&a.formUtils.$win.scrollTop(j.offset().top-20)),!d&&a.formUtils.haltValidation&&(a.formUtils.errorDisplayPreventedWhenHalted=!0),0===i.length&&!a.formUtils.haltValidation},a.fn.restrictLength=function(b){return new a.formUtils.lengthRestriction(this,b),this},a.fn.addSuggestions=function(b){var c=!1;return this.find("input").each(function(){var d=a(this);c=a.split(d.attr("data-suggestions")),c.length>0&&!d.hasClass("has-suggestions")&&(a.formUtils.suggest(d,c,b),d.addClass("has-suggestions"))}),this}}(a,window),function(a){"use strict";a.formUtils=a.extend(a.formUtils||{},{isLoadingModules:!1,loadedModules:{},registerLoadedModule:function(b){this.loadedModules[a.trim(b).toLowerCase()]=!0},hasLoadedModule:function(b){return a.trim(b).toLowerCase()in this.loadedModules},loadModules:function(b,c,d){if(a.formUtils.isLoadingModules)return void setTimeout(function(){a.formUtils.loadModules(b,c,d)},100);var e=function(b,c){var e=a.split(b),f=e.length,g=function(){f--,0===f&&(a.formUtils.isLoadingModules=!1,"function"==typeof d&&d())};f>0&&(a.formUtils.isLoadingModules=!0);var h="?_="+(new Date).getTime(),i=document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0];a.each(e,function(b,d){if(d=a.trim(d),0===d.length||a.formUtils.hasLoadedModule(d))g();else{var e=c+d+(".js"===d.slice(-3)?"":".js"),f=document.createElement("SCRIPT");"function"==typeof define&&define.amd?require([e+(".dev.js"===e.slice(-7)?h:"")],g):(f.type="text/javascript",f.onload=g,f.src=e+(".dev.js"===e.slice(-7)?h:""),f.onerror=function(){a.formUtils.warn("Unable to load form validation module "+e,!0),g()},f.onreadystatechange=function(){"complete"!==this.readyState&&"loaded"!==this.readyState||(g(),this.onload=null,this.onreadystatechange=null)},i.appendChild(f))}})};if(c)e(b,c);else{var f=function(){var c=!1;return a('script[src*="form-validator"]').each(function(){var a=this.src.split("form-validator")[1].split("node_modules").length>1;if(!a)return c=this.src.substr(0,this.src.lastIndexOf("/"))+"/","/"===c&&(c=""),!1}),c!==!1&&(e(b,c),!0)};f()||a(function(){var a=f();a||"function"==typeof d&&d()})}}})}(a),function(a){"use strict";a.split=function(b,c,d){d=void 0===d||d===!0;var e="[,|"+(d?"\\s":"")+"-]\\s*",f=new RegExp(e,"g");if("function"!=typeof c){if(!b)return[];var g=[];return a.each(b.split(c?c:f),function(b,c){c=a.trim(c),c.length&&g.push(c)}),g}b&&a.each(b.split(f),function(b,d){if(d=a.trim(d),d.length)return c(d,b)})},a.validate=function(b){var c=a.extend(a.formUtils.defaultConfig(),{form:"form",validateOnEvent:!1,validateOnBlur:!0,validateCheckboxRadioOnClick:!0,showHelpOnFocus:!0,addSuggestions:!0,modules:"",onModulesLoaded:null,language:!1,onSuccess:!1,onError:!1,onElementValidate:!1});if(b=a.extend(c,b||{}),a(window).trigger("formValidationPluginInit",[b]),b.lang&&"en"!==b.lang){var d="lang/"+b.lang+".js";b.modules+=b.modules.length?","+d:d}a(b.form).each(function(c,d){d.validationConfig=b;var e=a(d);e.trigger("formValidationSetup",[e,b]),e.find(".has-help-txt").unbind("focus.validation").unbind("blur.validation"),e.removeClass("has-validation-callback").unbind("submit.validation").unbind("reset.validation").find("input[data-validation],textarea[data-validation]").unbind("blur.validation"),e.bind("submit.validation",function(c){var d=a(this),e=function(){return c.stopImmediatePropagation(),!1};if(a.formUtils.haltValidation)return e();if(a.formUtils.isLoadingModules)return setTimeout(function(){d.trigger("submit.validation")},200),e();var f=d.isValid(b.language,b);if(a.formUtils.haltValidation)return e();if(!f||"function"!=typeof b.onSuccess)return f||"function"!=typeof b.onError?!!f||e():(b.onError(d),e());var g=b.onSuccess(d);return g===!1?e():void 0}).bind("reset.validation",function(){a.formUtils.dialogs.removeAllMessagesAndStyling(e,b)}).addClass("has-validation-callback"),b.showHelpOnFocus&&e.showHelpOnFocus(),b.addSuggestions&&e.addSuggestions(),b.validateOnBlur&&(e.validateOnBlur(b.language,b),e.bind("html5ValidationAttrsFound",function(){e.validateOnBlur(b.language,b)})),b.validateOnEvent&&e.validateOnEvent(b.language,b)}),""!==b.modules&&a.formUtils.loadModules(b.modules,null,function(){"function"==typeof b.onModulesLoaded&&b.onModulesLoaded();var c="string"==typeof b.form?a(b.form):b.form;a.formUtils.$win.trigger("validatorsLoaded",[c,b])})}}(a),function(a,b){"use strict";var c=a(b);a.formUtils=a.extend(a.formUtils||{},{$win:c,defaultConfig:function(){return{ignore:[],errorElementClass:"error",successElementClass:"valid",borderColorOnError:"#b94a48",errorMessageClass:"form-error",validationRuleAttribute:"data-validation",validationErrorMsgAttribute:"data-validation-error-msg",errorMessagePosition:"inline",errorMessageTemplate:{container:'
    {messages}
    ',messages:"{errorTitle}
      {fields}
    ",field:"
  • {msg}
  • "},scrollToTopOnError:!0,dateFormat:"yyyy-mm-dd",addValidClassOnAll:!1,decimalSeparator:".",inputParentClassOnError:"has-error",inputParentClassOnSuccess:"has-success",validateHiddenInputs:!1,inlineErrorMessageCallback:!1,submitErrorMessageCallback:!1}},validators:{},sanitizers:{},_events:{load:[],valid:[],invalid:[]},haltValidation:!1,addValidator:function(a){var b=0===a.name.indexOf("validate_")?a.name:"validate_"+a.name;void 0===a.validateOnKeyUp&&(a.validateOnKeyUp=!0),this.validators[b]=a},addSanitizer:function(a){this.sanitizers[a.name]=a},warn:function(a,c){"console"in b?"function"==typeof b.console.warn?b.console.warn(a):"function"==typeof b.console.log&&b.console.log(a):c&&alert(a)},getValue:function(a,b){var c=b?b.find(a):a;if(c.length>0){var d=c.eq(0).attr("type");return"radio"===d||"checkbox"===d?c.filter(":checked").val()||"":c.val()||""}return!1},validateInput:function(b,c,d,e,f){d=d||a.formUtils.defaultConfig(),c=c||a.formUtils.LANG,e.length||(e=b.parent());var g=this.getValue(b);b.valAttr("skipped",!1).one("beforeValidation",function(){(b.attr("disabled")||!b.is(":visible")&&!d.validateHiddenInputs)&&b.valAttr("skipped",1)}).trigger("beforeValidation",[g,c,d]);var h="true"===b.valAttr("optional"),i=!g&&h,j=b.attr(d.validationRuleAttribute),k=!0,l="",m={isValid:!0,shouldChangeDisplay:!0,errorMsg:""};if(!j||i||b.valAttr("skipped"))return m.shouldChangeDisplay=d.addValidClassOnAll,m;var n=b.valAttr("ignore");return n&&a.each(n.split(""),function(a,b){g=g.replace(new RegExp("\\"+b,"g"),"")}),a.split(j,function(h){0!==h.indexOf("validate_")&&(h="validate_"+h);var i=a.formUtils.validators[h];if(!i)throw new Error('Using undefined validator "'+h+'". Maybe you have forgotten to load the module that "'+h+'" belongs to?');if("validate_checkbox_group"===h&&(b=e.find('[name="'+b.attr("name")+'"]:eq(0)')),("keyup"!==f||i.validateOnKeyUp)&&(k=i.validatorFunction(g,b,d,c,e,f)),!k)return d.validateOnBlur&&b.validateOnKeyUp(c,d),l=a.formUtils.dialogs.resolveErrorMessage(b,i,h,d,c),!1}),k===!1?(b.trigger("validation",!1),m.errorMsg=l,m.isValid=!1,m.shouldChangeDisplay=!0):null===k?m.shouldChangeDisplay=!1:(b.trigger("validation",!0),m.shouldChangeDisplay=!0),"function"==typeof d.onElementValidate&&null!==l&&d.onElementValidate(m.isValid,b,e,l),b.trigger("afterValidation",[m,f]),m},parseDate:function(b,c,d){var e,f,g,h,i=c.replace(/[a-zA-Z]/gi,"").substring(0,1),j="^",k=c.split(i||null);if(a.each(k,function(a,b){j+=(a>0?"\\"+i:"")+"(\\d{"+b.length+"})"}),j+="$",d){var l=[];a.each(b.split(i),function(a,b){1===b.length&&(b="0"+b),l.push(b)}),b=l.join(i)}if(e=b.match(new RegExp(j)),null===e)return!1;var m=function(b,c,d){for(var e=0;e28&&(h%4!==0||h%100===0&&h%400!==0)||2===g&&f>29&&(h%4===0||h%100!==0&&h%400===0)||g>12||0===g)&&(!(this.isShortMonth(g)&&f>30||!this.isShortMonth(g)&&f>31||0===f)&&[h,g,f])},parseDateInt:function(a){return 0===a.indexOf("0")&&(a=a.replace("0","")),parseInt(a,10)},isShortMonth:function(a){return a%2===0&&a<7||a%2!==0&&a>7},lengthRestriction:function(b,c){var d=parseInt(c.text(),10),e=0,f=function(){var a=b.val().length;if(a>d){var f=b.scrollTop();b.val(b.val().substring(0,d)),b.scrollTop(f)}e=d-a,e<0&&(e=0),c.text(e)};a(b).bind("keydown keyup keypress focus blur",f).bind("cut paste",function(){setTimeout(f,100)}),a(document).bind("ready",f)},numericRangeCheck:function(b,c){var d=a.split(c),e=parseInt(c.substr(3),10);return 1===d.length&&c.indexOf("min")===-1&&c.indexOf("max")===-1&&(d=[c,c]),2===d.length&&(bparseInt(d[1],10))?["out",d[0],d[1]]:0===c.indexOf("min")&&be?["max",e]:["ok"]},_numSuggestionElements:0,_selectedSuggestion:null,_previousTypedVal:null,suggest:function(b,d,e){var f={css:{maxHeight:"150px",background:"#FFF",lineHeight:"150%",textDecoration:"underline",overflowX:"hidden",overflowY:"auto",border:"#CCC solid 1px",borderTop:"none",cursor:"pointer"},activeSuggestionCSS:{background:"#E9E9E9"}},g=function(a,b){var c=b.offset();a.css({width:b.outerWidth(),left:c.left+"px",top:c.top+b.outerHeight()+"px"})};e&&a.extend(f,e),f.css.position="absolute",f.css["z-index"]=9999,b.attr("autocomplete","off"),0===this._numSuggestionElements&&c.bind("resize",function(){a(".jquery-form-suggestions").each(function(){var b=a(this),c=b.attr("data-suggest-container");g(b,a(".suggestions-"+c).eq(0))})}),this._numSuggestionElements++;var h=function(b){var c=b.valAttr("suggestion-nr");a.formUtils._selectedSuggestion=null,a.formUtils._previousTypedVal=null,a(".jquery-form-suggestion-"+c).fadeOut("fast")};return b.data("suggestions",d).valAttr("suggestion-nr",this._numSuggestionElements).unbind("focus.suggest").bind("focus.suggest",function(){a(this).trigger("keyup"),a.formUtils._selectedSuggestion=null}).unbind("keyup.suggest").bind("keyup.suggest",function(){var c=a(this),d=[],e=a.trim(c.val()).toLocaleLowerCase();if(e!==a.formUtils._previousTypedVal){a.formUtils._previousTypedVal=e;var i=!1,j=c.valAttr("suggestion-nr"),k=a(".jquery-form-suggestion-"+j);if(k.scrollTop(0),""!==e){var l=e.length>2;a.each(c.data("suggestions"),function(a,b){var c=b.toLocaleLowerCase();return c===e?(d.push(""+b+""),i=!0,!1):void((0===c.indexOf(e)||l&&c.indexOf(e)>-1)&&d.push(b.replace(new RegExp(e,"gi"),"$&")))})}i||0===d.length&&k.length>0?k.hide():d.length>0&&0===k.length?(k=a("
    ").css(f.css).appendTo("body"),b.addClass("suggestions-"+j),k.attr("data-suggest-container",j).addClass("jquery-form-suggestions").addClass("jquery-form-suggestion-"+j)):d.length>0&&!k.is(":visible")&&k.show(),d.length>0&&e.length!==d[0].length&&(g(k,c),k.html(""),a.each(d,function(b,d){a("
    ").append(d).css({overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"5px"}).addClass("form-suggest-element").appendTo(k).click(function(){c.focus(),c.val(a(this).text()),c.trigger("change"),h(c)})}))}}).unbind("keydown.validation").bind("keydown.validation",function(b){var c,d,e=b.keyCode?b.keyCode:b.which,g=a(this);if(13===e&&null!==a.formUtils._selectedSuggestion){if(c=g.valAttr("suggestion-nr"),d=a(".jquery-form-suggestion-"+c),d.length>0){var i=d.find("div").eq(a.formUtils._selectedSuggestion).text();g.val(i),g.trigger("change"),h(g),b.preventDefault()}}else{c=g.valAttr("suggestion-nr"),d=a(".jquery-form-suggestion-"+c);var j=d.children();if(j.length>0&&a.inArray(e,[38,40])>-1){38===e?(null===a.formUtils._selectedSuggestion?a.formUtils._selectedSuggestion=j.length-1:a.formUtils._selectedSuggestion--,a.formUtils._selectedSuggestion<0&&(a.formUtils._selectedSuggestion=j.length-1)):40===e&&(null===a.formUtils._selectedSuggestion?a.formUtils._selectedSuggestion=0:a.formUtils._selectedSuggestion++,a.formUtils._selectedSuggestion>j.length-1&&(a.formUtils._selectedSuggestion=0));var k=d.innerHeight(),l=d.scrollTop(),m=d.children().eq(0).outerHeight(),n=m*a.formUtils._selectedSuggestion;return(nl+k)&&d.scrollTop(n),j.removeClass("active-suggestion").css("background","none").eq(a.formUtils._selectedSuggestion).addClass("active-suggestion").css(f.activeSuggestionCSS),b.preventDefault(),!1}}}).unbind("blur.suggest").bind("blur.suggest",function(){h(a(this))}),b},LANG:{errorTitle:"Form submission failed!",requiredField:"This is a required field",requiredFields:"You have not answered all required fields",badTime:"You have not given a correct time",badEmail:"You have not given a correct e-mail address",badTelephone:"You have not given a correct phone number",badSecurityAnswer:"You have not given a correct answer to the security question",badDate:"You have not given a correct date",lengthBadStart:"The input value must be between ",lengthBadEnd:" characters",lengthTooLongStart:"The input value is longer than ",lengthTooShortStart:"The input value is shorter than ",notConfirmed:"Input values could not be confirmed",badDomain:"Incorrect domain value",badUrl:"The input value is not a correct URL",badCustomVal:"The input value is incorrect",andSpaces:" and spaces ",badInt:"The input value was not a correct number",badSecurityNumber:"Your social security number was incorrect",badUKVatAnswer:"Incorrect UK VAT Number",badUKNin:"Incorrect UK NIN",badUKUtr:"Incorrect UK UTR Number",badStrength:"The password isn't strong enough",badNumberOfSelectedOptionsStart:"You have to choose at least ",badNumberOfSelectedOptionsEnd:" answers",badAlphaNumeric:"The input value can only contain alphanumeric characters ",badAlphaNumericExtra:" and ",wrongFileSize:"The file you are trying to upload is too large (max %s)",wrongFileType:"Only files of type %s is allowed",groupCheckedRangeStart:"Please choose between ",groupCheckedTooFewStart:"Please choose at least ",groupCheckedTooManyStart:"Please choose a maximum of ",groupCheckedEnd:" item(s)",badCreditCard:"The credit card number is not correct",badCVV:"The CVV number was not correct",wrongFileDim:"Incorrect image dimensions,",imageTooTall:"the image can not be taller than",imageTooWide:"the image can not be wider than",imageTooSmall:"the image was too small",min:"min",max:"max",imageRatioNotAccepted:"Image ratio is not be accepted",badBrazilTelephoneAnswer:"The phone number entered is invalid",badBrazilCEPAnswer:"The CEP entered is invalid",badBrazilCPFAnswer:"The CPF entered is invalid",badPlPesel:"The PESEL entered is invalid",badPlNip:"The NIP entered is invalid",badPlRegon:"The REGON entered is invalid",badreCaptcha:"Please confirm that you are not a bot",passwordComplexityStart:"Password must contain at least ",passwordComplexitySeparator:", ",passwordComplexityUppercaseInfo:" uppercase letter(s)",passwordComplexityLowercaseInfo:" lowercase letter(s)",passwordComplexitySpecialCharsInfo:" special character(s)",passwordComplexityNumericCharsInfo:" numeric character(s)",passwordComplexityEnd:"."}})}(a,window),function(a){a.formUtils.addValidator({name:"email",validatorFunction:function(b){var c=b.toLowerCase().split("@"),d=c[0],e=c[1];if(d&&e){if(0===d.indexOf('"')){var f=d.length;if(d=d.replace(/\"/g,""),d.length!==f-2)return!1}return a.formUtils.validators.validate_domain.validatorFunction(c[1])&&0!==d.indexOf(".")&&"."!==d.substring(d.length-1,d.length)&&d.indexOf("..")===-1&&!/[^\w\+\.\-\#\-\_\~\!\$\&\'\(\)\*\+\,\;\=\:]/.test(d)}return!1},errorMessage:"",errorMessageKey:"badEmail"}),a.formUtils.addValidator({name:"domain",validatorFunction:function(a){return a.length>0&&a.length<=253&&!/[^a-zA-Z0-9]/.test(a.slice(-2))&&!/[^a-zA-Z0-9]/.test(a.substr(0,1))&&!/[^a-zA-Z0-9\.\-]/.test(a)&&1===a.split("..").length&&a.split(".").length>1},errorMessage:"",errorMessageKey:"badDomain"}),a.formUtils.addValidator({name:"required",validatorFunction:function(b,c,d,e,f){switch(c.attr("type")){case"checkbox":return c.is(":checked");case"radio":return f.find('input[name="'+c.attr("name")+'"]').filter(":checked").length>0;default:return""!==a.trim(b)}},errorMessage:"",errorMessageKey:function(a){return"top"===a.errorMessagePosition||"function"==typeof a.errorMessagePosition?"requiredFields":"requiredField"}}),a.formUtils.addValidator({name:"length",validatorFunction:function(b,c,d,e){var f=c.valAttr("length"),g=c.attr("type");if(void 0===f)return alert('Please add attribute "data-validation-length" to '+c[0].nodeName+" named "+c.attr("name")),!0;var h,i="file"===g&&void 0!==c.get(0).files?c.get(0).files.length:b.length,j=a.formUtils.numericRangeCheck(i,f);switch(j[0]){case"out":this.errorMessage=e.lengthBadStart+f+e.lengthBadEnd,h=!1;break;case"min":this.errorMessage=e.lengthTooShortStart+j[1]+e.lengthBadEnd,h=!1;break;case"max":this.errorMessage=e.lengthTooLongStart+j[1]+e.lengthBadEnd,h=!1;break;default:h=!0}return h},errorMessage:"",errorMessageKey:""}),a.formUtils.addValidator({name:"url",validatorFunction:function(b){var c=/^(https?|ftp):\/\/((((\w|-|\.|~|[\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])(\w|-|\.|~|[\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])(\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|\[|\]|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#(((\w|-|\.|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i;if(c.test(b)){var d=b.split("://")[1],e=d.indexOf("/");return e>-1&&(d=d.substr(0,e)),a.formUtils.validators.validate_domain.validatorFunction(d)}return!1},errorMessage:"",errorMessageKey:"badUrl"}),a.formUtils.addValidator({name:"number",validatorFunction:function(a,b,c){if(""!==a){var d,e,f=b.valAttr("allowing")||"",g=b.valAttr("decimal-separator")||c.decimalSeparator,h=!1,i=b.valAttr("step")||"",j=!1,k=b.attr("data-sanitize")||"",l=k.match(/(^|[\s])numberFormat([\s]|$)/i);if(l){if(!window.numeral)throw new ReferenceError("The data-sanitize value numberFormat cannot be used without the numeral library. Please see Data Validation in http://www.formvalidator.net for more information.");a.length&&(a=String(numeral().unformat(a)))}if(f.indexOf("number")===-1&&(f+=",number"),f.indexOf("negative")===-1&&0===a.indexOf("-"))return!1;if(f.indexOf("range")>-1&&(d=parseFloat(f.substring(f.indexOf("[")+1,f.indexOf(";"))),e=parseFloat(f.substring(f.indexOf(";")+1,f.indexOf("]"))),h=!0),""!==i&&(j=!0),","===g){if(a.indexOf(".")>-1)return!1;a=a.replace(",",".")}if(""===a.replace(/[0-9-]/g,"")&&(!h||a>=d&&a<=e)&&(!j||a%i===0))return!0;if(f.indexOf("float")>-1&&null!==a.match(new RegExp("^([0-9-]+)\\.([0-9]+)$"))&&(!h||a>=d&&a<=e)&&(!j||a%i===0))return!0}return!1},errorMessage:"",errorMessageKey:"badInt"}),a.formUtils.addValidator({name:"alphanumeric",validatorFunction:function(b,c,d,e){var f="^([a-zA-Z0-9",g="]+)$",h=c.valAttr("allowing"),i="",j=!1;if(h){i=f+h+g;var k=h.replace(/\\/g,"");k.indexOf(" ")>-1&&(j=!0,k=k.replace(" ",""),k+=e.andSpaces||a.formUtils.LANG.andSpaces),e.badAlphaNumericAndExtraAndSpaces&&e.badAlphaNumericAndExtra?j?this.errorMessage=e.badAlphaNumericAndExtraAndSpaces+k:this.errorMessage=e.badAlphaNumericAndExtra+k+e.badAlphaNumericExtra:this.errorMessage=e.badAlphaNumeric+e.badAlphaNumericExtra+k; +}else i=f+g,this.errorMessage=e.badAlphaNumeric;return new RegExp(i).test(b)},errorMessage:"",errorMessageKey:""}),a.formUtils.addValidator({name:"custom",validatorFunction:function(a,b){var c=new RegExp(b.valAttr("regexp"));return c.test(a)},errorMessage:"",errorMessageKey:"badCustomVal"}),a.formUtils.addValidator({name:"date",validatorFunction:function(b,c,d){var e=c.valAttr("format")||d.dateFormat||"yyyy-mm-dd",f="false"===c.valAttr("require-leading-zero");return a.formUtils.parseDate(b,e,f)!==!1},errorMessage:"",errorMessageKey:"badDate"}),a.formUtils.addValidator({name:"checkbox_group",validatorFunction:function(b,c,d,e,f){var g=!0,h=c.attr("name"),i=a('input[type=checkbox][name^="'+h+'"]',f),j=i.filter(":checked").length,k=c.valAttr("qty");if(void 0===k){var l=c.get(0).nodeName;alert('Attribute "data-validation-qty" is missing from '+l+" named "+c.attr("name"))}var m=a.formUtils.numericRangeCheck(j,k);switch(m[0]){case"out":this.errorMessage=e.groupCheckedRangeStart+k+e.groupCheckedEnd,g=!1;break;case"min":this.errorMessage=e.groupCheckedTooFewStart+m[1]+(e.groupCheckedTooFewEnd||e.groupCheckedEnd),g=!1;break;case"max":this.errorMessage=e.groupCheckedTooManyStart+m[1]+(e.groupCheckedTooManyEnd||e.groupCheckedEnd),g=!1;break;default:g=!0}if(!g){var n=function(){i.unbind("click",n),i.filter("*[data-validation]").validateInputOnBlur(e,d,!1,"blur")};i.bind("click",n)}return g}})}(a)}); \ No newline at end of file diff --git a/form-validator/jsconf.js b/form-validator/jsconf.js index 48bfb7f..1499923 100644 --- a/form-validator/jsconf.js +++ b/form-validator/jsconf.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/ar.js b/form-validator/lang/ar.js new file mode 100644 index 0000000..8b80062 --- /dev/null +++ b/form-validator/lang/ar.js @@ -0,0 +1,9 @@ +/** File generated by Grunt -- do not modify + * JQUERY-FORM-VALIDATOR + * + * @version 2.3.79 + * @website http://formvalidator.net/ + * @author Victor Jonsson, http://victorjonsson.se + * @license MIT + */ +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){"use strict";a.formUtils.registerLoadedModule("lang/ar"),a(b).bind("validatorsLoaded",function(){a.formUtils.LANG={errorTitle:"فَشِلَ إرسال النموذج",requiredField:"هذا الحقل مطلوب",requiredFields:"لم يتم ملأ جميع الحقول المطلوبة.",badTime:"حقل الوقت خاطىء",badEmail:"البريد الإلكتروني المدخل خاطئ",badTelephone:"رقم الهاتف المدخل خاطئ",badSecurityAnswer:"لم يتم الإجابة عن سؤال الأمان",badDate:"تاريخ مدخل خاطئ",lengthBadStart:"القيمة المدخلة يجب أن تكون بين ",lengthBadEnd:" حروف",lengthTooLongStart:"القيمة المدخل أطول من ",lengthTooShortStart:"القيمة المدخل أقصر من ",notConfirmed:"لم يتم تأكيد القيمة المدخلة",badDomain:"قيمة نطاق خاطئة",badUrl:"القيمة المدخلة ليست رابطاً صالحاً",badCustomVal:"القيمة المدخلة غير صالحة",andSpaces:" ومسافات ",badInt:"القيمة المدخلة ليست رقماً صحيحاً",badSecurityNumber:"رقم بطاقة الهوية غير صحيح",badUKVatAnswer:"رقم UK VAT غير صحيح",badUKNin:"غير صحيح UK NINرقم ",badUKUtr:"غير صحيح UK UTR رقم",badStrength:"كلمة المرور غير قوية",badNumberOfSelectedOptionsStart:"يجب اختيار على الأقل ",badNumberOfSelectedOptionsEnd:" أجوبة",badAlphaNumeric:"القيمة المدخلة يجب أن تتضمن حروف وأرقام فقط ",badAlphaNumericExtra:" و ",wrongFileSize:"الملف المراد تحميله كبير جداً (الحد المسموج %s)",wrongFileType:"ملفات من نوع %s فقط مسموحة",groupCheckedRangeStart:"من فضلك اختر بين ",groupCheckedTooFewStart:"من فضلك اختر على الأقل ",groupCheckedTooManyStart:"من فضلك اختر بحد أقصى ",groupCheckedEnd:" مرات",badCreditCard:"رقم بطاقة ائتمانية خاطىء",badCVV:"رمز الأمان خاطئ",wrongFileDim:"حدود الصورة غير صالحة",imageTooTall:"الصورة يمكن أن تكون أطول من",imageTooWide:"الصورة يمكن أن تكون أعرض من",imageTooSmall:"صورة صغيرة جداً",min:"أدنى",max:"أقصى",imageRatioNotAccepted:"أبعاد صورة غير مقبولة",badBrazilTelephoneAnswer:"رقم هاتف مدخل خاطىء",badBrazilCEPAnswer:"قيمة CEP المدخلة غير صحيحة",badBrazilCPFAnswer:"قيمة CPF المدخلة غير صحيحة",badPlPesel:"قيمة Pl PESEL المدخلة غير صحيحة",badPlNip:"قيمة Pl NIP المدخلة غير صحيحة",badPlRegon:"قيمة Pl REGON المدخلة غير صحيحة",badreCaptcha:"من فضلك أكد أنك لست روبوتاً",passwordComplexityStart:"كملة المرور تتكون على الأقل من ",passwordComplexitySeparator:", ",passwordComplexityUppercaseInfo:" حروف كبيرة",passwordComplexityLowercaseInfo:" حروف صغيرة",passwordComplexitySpecialCharsInfo:" رموز خاصة",passwordComplexityNumericCharsInfo:" أرقام",passwordComplexityEnd:"."}})}(a,window)}); \ No newline at end of file diff --git a/form-validator/lang/ca.js b/form-validator/lang/ca.js index 563e34a..5e92f50 100644 --- a/form-validator/lang/ca.js +++ b/form-validator/lang/ca.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/cs.js b/form-validator/lang/cs.js index 6102f73..b6247ce 100644 --- a/form-validator/lang/cs.js +++ b/form-validator/lang/cs.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/da.js b/form-validator/lang/da.js index 9c3330a..f0365b7 100644 --- a/form-validator/lang/da.js +++ b/form-validator/lang/da.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/de.js b/form-validator/lang/de.js index 7bfd02b..1196abf 100644 --- a/form-validator/lang/de.js +++ b/form-validator/lang/de.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/es.js b/form-validator/lang/es.js index 44263cf..ebfa545 100644 --- a/form-validator/lang/es.js +++ b/form-validator/lang/es.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/fa.js b/form-validator/lang/fa.js index 7868a81..e973dd5 100644 --- a/form-validator/lang/fa.js +++ b/form-validator/lang/fa.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/fr.js b/form-validator/lang/fr.js index e830019..1526584 100644 --- a/form-validator/lang/fr.js +++ b/form-validator/lang/fr.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/it.js b/form-validator/lang/it.js index 9160bed..76b83d5 100644 --- a/form-validator/lang/it.js +++ b/form-validator/lang/it.js @@ -1,9 +1,9 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT */ -!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){"use strict";a.formUtils.registerLoadedModule("lang/it"),a(b).bind("validatorsLoaded",function(){a.formUtils.LANG={errorTitle:"Impossibile inviare il modulo!",requiredField:"Campo obbligatorio",requiredFields:"Non sono stati compilati tutti i campi richiesti",badTime:"L'ora scelta non è valida",badEmail:"Questo indirizzo email non è valido",badTelephone:"Il numero di telefono imputato non è valido",badSecurityAnswer:"La risposta alla domanda di sicurezza è errata",badDate:"La data scelta non è valida",lengthBadStart:"La sua risposta non può essere più lunga di ",lengthBadEnd:" caratteri",lengthTooLongStart:"La lunghezza della risposta deve essere minore di ",lengthTooShortStart:"La lunghezza della risposta deve essere maggiore di ",notConfirmed:"Il valore non è stato confermato.",badDomain:"Il dominio inserito non è corretto.",badUrl:"L' URL inserito non è valido",badCustomVal:"I valori inseriti non sono validi",andSpaces:" e spazi ",badInt:"Il numero inserito non è valido",badSecurityNumber:"Il numero di sicurezza inserito non è valido",badUKVatAnswer:"La Partita IVA (VAT) inserita non è valida nel Regno Unito",badStrength:"La password proposta non è sufficientemente sicura",badNumberOfSelectedOptionsStart:"Deve selezionare almeno",badNumberOfSelectedOptionsEnd:" risposta/e",badAlphaNumeric:"Il valore proposto deve contenere caratteri alfanumerici (a-z e 1234...)",badAlphaNumericExtra:"",wrongFileSize:"Il file che si sta cercando di caricare è troppo grande (massimo %s)",wrongFileType:"Solo i file di tipo %s possono essere inviati",groupCheckedRangeStart:"Si prega di scegliere tra ",groupCheckedTooFewStart:"Si prega di selezionare un minimo di ",groupCheckedTooManyStart:"Si prega di selezionare un massimo di ",groupCheckedEnd:" opzione/i",badCreditCard:"Il numero di carta di credito non risulta valido",badCVV:"CVV non valido",wrongFileDim:"La dimensione dell'immagine non è valida,",imageTooTall:"il lato alto dell'immagine non può essere maggiore di",imageTooWide:"il lato lungo dell'immagine non può essere maggiore di",imageTooSmall:"L'immagine è troppo piccola",min:"min.",max:"máx.",imageRatioNotAccepted:"La proporzione dell' immagine (altezza x larghezza) non è valida"}})}(a,window)}); +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){"use strict";a.formUtils.registerLoadedModule("lang/it"),a(b).bind("validatorsLoaded",function(){a.formUtils.LANG={errorTitle:"Impossibile inviare il modulo!",requiredField:"Campo obbligatorio",requiredFields:"Non sono stati compilati tutti i campi richiesti",badTime:"L'ora scelta non è valida",badEmail:"Questo indirizzo email non è valido",badTelephone:"Il numero di telefono imputato non è valido",badSecurityAnswer:"La risposta alla domanda di sicurezza è errata",badDate:"La data scelta non è valida",lengthBadStart:"La sua risposta non può essere più lunga di ",lengthBadEnd:" caratteri",lengthTooLongStart:"La lunghezza della risposta deve essere minore di ",lengthTooShortStart:"La lunghezza della risposta deve essere maggiore di ",notConfirmed:"Il valore non è stato confermato.",badDomain:"Il dominio inserito non è corretto.",badUrl:"L' URL inserito non è valido",badCustomVal:"I valori inseriti non sono validi",andSpaces:" e spazi ",badInt:"Il numero inserito non è valido",badSecurityNumber:"Il numero di sicurezza inserito non è valido",badUKVatAnswer:"La Partita IVA (VAT) inserita non è valida nel Regno Unito",badStrength:"La password proposta non è sufficientemente sicura",badNumberOfSelectedOptionsStart:"Deve selezionare almeno",badNumberOfSelectedOptionsEnd:" risposta/e",badAlphaNumeric:"Il valore proposto deve contenere caratteri alfanumerici (a-z e 1234...)",badAlphaNumericExtra:"",wrongFileSize:"Il file che si sta cercando di caricare è troppo grande (massimo %s)",wrongFileType:"Solo i file di tipo %s possono essere inviati",groupCheckedRangeStart:"Si prega di scegliere tra ",groupCheckedTooFewStart:"Si prega di selezionare un minimo di ",groupCheckedTooManyStart:"Si prega di selezionare un massimo di ",groupCheckedEnd:" opzione/i",badCreditCard:"Il numero di carta di credito non risulta valido",badCVV:"CVV non valido",wrongFileDim:"La dimensione dell'immagine non è valida,",imageTooTall:"il lato alto dell'immagine non può essere maggiore di",imageTooWide:"il lato lungo dell'immagine non può essere maggiore di",imageTooSmall:"L'immagine è troppo piccola",min:"min.",max:"máx.",imageRatioNotAccepted:"La proporzione dell' immagine (altezza x larghezza) non è valida"}})}(a,window)}); \ No newline at end of file diff --git a/form-validator/lang/ka.js b/form-validator/lang/ka.js new file mode 100644 index 0000000..0d88991 --- /dev/null +++ b/form-validator/lang/ka.js @@ -0,0 +1,9 @@ +/** File generated by Grunt -- do not modify + * JQUERY-FORM-VALIDATOR + * + * @version 2.3.79 + * @website http://formvalidator.net/ + * @author Victor Jonsson, http://victorjonsson.se + * @license MIT + */ +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){"use strict";a.formUtils.registerLoadedModule("lang/ka"),a(b).bind("validatorsLoaded",function(){a.formUtils.LANG={errorTitle:"ფორმა ვერ გაიგზავნა!",requiredField:"ველის შევსება სავალდებულოა",requiredFields:"თქვენ არ შეგივსიათ ყველა სავალდებულო ველი",badTime:"თქვენ მიუთითეთ არასწორი დრო",badEmail:"თქვენ მიუთითეთ არასწორი ელ.ფოსტის მისამართი",badTelephone:"თქვენ მიუთითეთ არასწორი ტელეფონის ნომერი",badSecurityAnswer:"თქვენ გაეცით არასწორი პასუხი უსაფრთხოების კითხვას",badDate:"თქვენ მიუთითეთ არასწორი თარიღი",lengthBadStart:"ველის მნიშვნელობის სიგრძე უნდა იყოს ",lengthBadEnd:" შუალედში",lengthTooLongStart:"ველის მნიშვნელობის სიგრძე უნდა იყოს მაქსიმუმ ",lengthTooShortStart:"ველის მნიშვნელობის სიგრძე უნდა იყოს მინიმუმ ",notConfirmed:"ველის მნიშვნელობები ვერ დადასტურდა",badDomain:"არასწორი დომენის მისამართი",badUrl:"ველის მნიშვნელობა არ არის მართებული URL მისამართი",badCustomVal:"ველის მნიშვნელობა არ არის მართებული",andSpaces:" და გამოტოვებები ",badInt:"ველის მნიშვნელობა არ არის მართებული რიცხვი",badStrength:"პაროლი არ არის საკმარისად ძლიერი (კარგი)",badNumberOfSelectedOptionsStart:"თქვენ უნდა აირჩიოთ სულ მცირე ",badNumberOfSelectedOptionsEnd:" პასუხი",badAlphaNumeric:"ველის მნიშვნელობა უნდა შეიცავდეს მხოლოდ ციფრებსა და ასოებს ",badAlphaNumericExtra:" და ",wrongFileSize:"ფაილი, რომლის ატვირთვასაც ცდილობთ არის ძალიან დიდი (დასაშვებია მაქსიმუმ %s)",wrongFileType:"დასაშვებია მხოლოდ შემდეგი გაფართოების ფაილები: %s",groupCheckedRangeStart:"გთხოვთ, აირჩიოთ ",groupCheckedTooFewStart:"გთხოვთ, აირჩიოთ სულ მცირე ",groupCheckedTooManyStart:"გთხოვთ, აირჩიოთ მაქსიმუმ ",groupCheckedEnd:" პუნქტი",badCreditCard:"საკრედიტო ბარათის ნომერი არ არის მართებული",badCVV:"CVV კოდი არ არის მართებული",wrongFileDim:"არამართებული სურათის ზომები,",imageTooTall:"სურათი არ უნდა იყოს უფრო გრძელი ვიდრე",imageTooWide:"სურათი არ უნდა იყოს უფრო ფართე ვიდრე",imageTooSmall:"სურათი არის ძალიან პატარა",min:"მინიმუმ",max:"მაქსიმუმ",imageRatioNotAccepted:"სურათის სიგრძისა და სიგანის ეს თანაფარდობა დაუშვებელია",badBrazilTelephoneAnswer:"მითითებული ტელეფონის ნომერი არ არის მართებული",badreCaptcha:"დაადასტურეთ, რომ არ ხართ რობოტი",passwordComplexityStart:"პაროლი უნდა შეიცავდეს მინიმუმ ",passwordComplexitySeparator:", ",passwordComplexityUppercaseInfo:" დიდი ასო(ები)",passwordComplexityLowercaseInfo:" პატარა ასო(ები)",passwordComplexitySpecialCharsInfo:" სპეციალური სიმბოლო(ები)",passwordComplexityNumericCharsInfo:" რიცხვითი მნიშვნელობა(ები)",passwordComplexityEnd:"."}})}(a,window)}); \ No newline at end of file diff --git a/form-validator/lang/ko.js b/form-validator/lang/ko.js index e031659..7e2c0ea 100644 --- a/form-validator/lang/ko.js +++ b/form-validator/lang/ko.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/nl.js b/form-validator/lang/nl.js index a997f51..ae0f5f9 100644 --- a/form-validator/lang/nl.js +++ b/form-validator/lang/nl.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/no.js b/form-validator/lang/no.js index fdd911d..7b4b1eb 100644 --- a/form-validator/lang/no.js +++ b/form-validator/lang/no.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/pl.js b/form-validator/lang/pl.js index 60f194e..f0af0e1 100644 --- a/form-validator/lang/pl.js +++ b/form-validator/lang/pl.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/pt.js b/form-validator/lang/pt.js index 4f2bc3a..089ab14 100644 --- a/form-validator/lang/pt.js +++ b/form-validator/lang/pt.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/ro.js b/form-validator/lang/ro.js index 8f521d5..b413e2e 100644 --- a/form-validator/lang/ro.js +++ b/form-validator/lang/ro.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/ru.js b/form-validator/lang/ru.js index b8463b2..63f018c 100644 --- a/form-validator/lang/ru.js +++ b/form-validator/lang/ru.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/sv.js b/form-validator/lang/sv.js index e48642e..7f574af 100644 --- a/form-validator/lang/sv.js +++ b/form-validator/lang/sv.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/tr.js b/form-validator/lang/tr.js index fbe3da9..4fc53d3 100644 --- a/form-validator/lang/tr.js +++ b/form-validator/lang/tr.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/lang/vi.js b/form-validator/lang/vi.js index 3655132..02f19f0 100644 --- a/form-validator/lang/vi.js +++ b/form-validator/lang/vi.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/location.js b/form-validator/location.js index 147e6e5..0598731 100644 --- a/form-validator/location.js +++ b/form-validator/location.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/logic.js b/form-validator/logic.js index bb69c90..3656f0c 100644 --- a/form-validator/logic.js +++ b/form-validator/logic.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/poland.js b/form-validator/poland.js index dc6131d..e66f470 100644 --- a/form-validator/poland.js +++ b/form-validator/poland.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/sanitize.js b/form-validator/sanitize.js index b2578c7..3bfc959 100644 --- a/form-validator/sanitize.js +++ b/form-validator/sanitize.js @@ -1,9 +1,9 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT */ -!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){"use strict";a.formUtils.registerLoadedModule("sanitize");var c='[type="button"], [type="submit"], [type="radio"], [type="checkbox"], [type="reset"], [type="search"]',d={upper:function(a){return a.toLocaleUpperCase()},lower:function(a){return a.toLocaleLowerCase()},trim:function(b){return a.trim(b)},trimLeft:function(a){return a.replace(/^\s+/,"")},trimRight:function(a){return a.replace(/\s+$/,"")},capitalize:function(b){var c=b.split(" ");return a.each(c,function(a,b){c[a]=b.substr(0,1).toUpperCase()+b.substr(1,b.length)}),c.join(" ")},insert:function(a,b,c){var d=(b.attr("data-sanitize-insert-"+c)||"").replace(/\[SPACE\]/g," ");return"left"===c&&0===a.indexOf(d)||"right"===c&&a.substring(a.length-d.length)===d?a:("left"===c?d:"")+a+("right"===c?d:"")},insertRight:function(a,b){return this.insert(a,b,"right")},insertLeft:function(a,b){return this.insert(a,b,"left")},numberFormat:function(a,c){if(0===a.length)return a;if(!("numeral"in b))throw new ReferenceError('Using sanitation function "numberFormat" requires that you include numeral.js (http://numeraljs.com/)');return a=numeral().unformat(a),a=numeral(a).format(c.attr("data-sanitize-number-format"))},strip:function(b,c){var d=c.attr("data-sanitize-strip")||"";return a.split(d,function(c){var d=new RegExp(a.isNumeric(c)?c:"\\"+c,"g");b=b.replace(d,"")}),b},escape:function(b,c){var d=c.valAttr("is-escaped"),e={"<":"__%AMP%__lt;",">":"__%AMP%__gt;","&":"__%AMP%__amp;","'":"__%AMP%__#8217;",'"':"__%AMP%__quot;"};return"yes"===d?b:(c.valAttr("is-escaped","yes"),c.one("keyup",function(a){9!==a.keyCode&&c.valAttr("is-escaped","no")}),a.each(e,function(a,c){b=b.replace(new RegExp(a,"g"),c)}),b.replace(new RegExp("__%AMP%__","g"),"&"))}},e=function(b,e,f){e||(e=a("form")),e.each||(e=a(e));var g=function(){var b=a(this),c=b.val();a.split(b.attr("data-sanitize"),function(a){if(!(a in d))throw new Error('Use of unknown sanitize command "'+a+'"');c=d[a](c,b,f)}),b.val(c).trigger("keyup.validation")};e.each(function(){var b=a(this);f.sanitizeAll&&b.find("input,textarea").not(c).each(function(){var b=a(this),c=b.attr("data-sanitize")||"";b.attr("data-sanitize",f.sanitizeAll+" "+c)}),b.find("[data-sanitize]").unbind("blur.sanitation",g).bind("blur.sanitation",g),a(function(){b.trigger("blur.sanitation")})})};a(b).on("validatorsLoaded formValidationSetup",e),a.formUtils.setupSanitation=e}(a,window)}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){"use strict";a.formUtils.addSanitizer({name:"upper",sanitizerFunction:function(a){return a.toLocaleUpperCase()}}),a.formUtils.addSanitizer({name:"lower",sanitizerFunction:function(a){return a.toLocaleLowerCase()}}),a.formUtils.addSanitizer({name:"trim",sanitizerFunction:function(b){return a.trim(b)}}),a.formUtils.addSanitizer({name:"trimLeft",sanitizerFunction:function(a){return a.replace(/^\s+/,"")}}),a.formUtils.addSanitizer({name:"trimRight",sanitizerFunction:function(a){return a.replace(/\s+$/,"")}}),a.formUtils.addSanitizer({name:"capitalize",sanitizerFunction:function(b){var c=b.split(" ");return a.each(c,function(a,b){c[a]=b.substr(0,1).toUpperCase()+b.substr(1,b.length)}),c.join(" ")}}),a.formUtils.addSanitizer({name:"insert",sanitizerFunction:function(a,b,c){var d=(b.attr("data-sanitize-insert-"+c)||"").replace(/\[SPACE\]/g," ");return"left"===c&&0===a.indexOf(d)||"right"===c&&a.substring(a.length-d.length)===d?a:("left"===c?d:"")+a+("right"===c?d:"")}}),a.formUtils.addSanitizer({name:"insertRight",sanitizerFunction:function(b,c){return a.formUtils.sanitizers.insert.sanitizerFunction(b,c,"right")}}),a.formUtils.addSanitizer({name:"insertLeft",sanitizerFunction:function(b,c){return a.formUtils.sanitizers.insert.sanitizerFunction(b,c,"left")}}),a.formUtils.addSanitizer({name:"numberFormat",sanitizerFunction:function(a,c){if(0===a.length)return a;if(!("numeral"in b))throw new ReferenceError('Using sanitation function "numberFormat" requires that you include numeral.js (http://numeraljs.com/)');return a=numeral().unformat(a),a=numeral(a).format(c.attr("data-sanitize-number-format"))}}),a.formUtils.addSanitizer({name:"strip",sanitizerFunction:function(b,c){var d=c.attr("data-sanitize-strip")||"";return a.split(d,function(c){var d=new RegExp(a.isNumeric(c)?c:"\\"+c,"g");b=b.replace(d,"")}),b}}),a.formUtils.addSanitizer({name:"escape",sanitizerFunction:function(b,c){var d=c.valAttr("is-escaped"),e={"<":"__%AMP%__lt;",">":"__%AMP%__gt;","&":"__%AMP%__amp;","'":"__%AMP%__#8217;",'"':"__%AMP%__quot;"};return"yes"===d?b:(c.valAttr("is-escaped","yes"),c.one("keyup",function(a){9!==a.keyCode&&c.valAttr("is-escaped","no")}),a.each(e,function(a,c){b=b.replace(new RegExp(a,"g"),c)}),b.replace(new RegExp("__%AMP%__","g"),"&"))}}),a.formUtils.registerLoadedModule("sanitize");var c='[type="button"], [type="submit"], [type="radio"], [type="checkbox"], [type="reset"], [type="search"]',d=function(b,d,e){d||(d=a("form")),d.each||(d=a(d));var f=function(){var b=a(this),c=b.val();a.split(b.attr("data-sanitize"),function(d){var f=a.formUtils.sanitizers[d];if(!f)throw new Error('Use of unknown sanitize command "'+d+'"');c=f.sanitizerFunction(c,b,e)}),b.val(c).trigger("keyup.validation")};d.each(function(){var b=a(this);e.sanitizeAll&&b.find("input,textarea").not(c).each(function(){var b=a(this),c=b.attr("data-sanitize")||"";b.attr("data-sanitize",e.sanitizeAll+" "+c)}),b.find("[data-sanitize]").unbind("blur.sanitation",f).bind("blur.sanitation",f),a(function(){b.trigger("blur.sanitation")})})};a(b).on("validatorsLoaded formValidationSetup",d),a.formUtils.setupSanitation=d}(a,window)}); \ No newline at end of file diff --git a/form-validator/security.js b/form-validator/security.js index b26aed1..c1fd315 100644 --- a/form-validator/security.js +++ b/form-validator/security.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/sepa.js b/form-validator/sepa.js index a94c911..5b60f92 100644 --- a/form-validator/sepa.js +++ b/form-validator/sepa.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/sweden.js b/form-validator/sweden.js index d883569..d4a367b 100644 --- a/form-validator/sweden.js +++ b/form-validator/sweden.js @@ -1,9 +1,9 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT */ -!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){a.formUtils.registerLoadedModule("sweden"),a.formUtils.addValidator({name:"swesec",validatorFunction:function(c,d){var e,f,g,h;if(d.valAttr("use-hyphen")){if(h=c.split("-"),2!==h.length)return!1;c=h.join("")}if(!c.match(/^(\d{4})(\d{2})(\d{2})(\d{4})$/))return!1;e=RegExp.$1,f=a.formUtils.parseDateInt(RegExp.$2),g=a.formUtils.parseDateInt(RegExp.$3),b.ssnGender=parseInt(RegExp.$4.substring(2,3))%2===0?"female":"male";var i=[31,28,31,30,31,30,31,31,30,31,30,31];if((e%400===0||e%4===0&&e%100!==0)&&(i[1]=29),f<1||f>12||g<1||g>i[f-1])return!1;c=c.substring(2,c.length);for(var j="",k=0;k-1},errorMessage:"",errorMessageKey:"badCustomVal",counties:["stockholms län","uppsala län","södermanlands län","östergötlands län","jönköpings län","kronobergs län","kalmar län","gotlands län","blekinge län","skåne län","hallands län","västra götalands län","värmlands län","örebro län","västmanlands län","dalarnas län","gävleborgs län","västernorrlands län","jämtlands län","västerbottens län","norrbottens län"]}),a.formUtils.addValidator({name:"swemunicipality",validatorFunction:function(b){return b=b.toLowerCase(),a.inArray(b,this.municipalities)!==-1||("s kommun"===b.substr(-8)&&a.inArray(b.substr(0,b.length-8),this.municipalities)>-1||" kommun"===b.substr(-7)&&a.inArray(b.substr(0,b.length-7),this.municipalities)>-1)},errorMessage:"",errorMessageKey:"badCustomVal",municipalities:["ale","alingsås","alvesta","aneby","arboga","arjeplog","arvidsjaur","arvika","askersund","avesta","bengtsfors","berg","bjurholm","bjuv","boden","bollebygd","bollnäs","borgholm","borlänge","borås","botkyrka","boxholm","bromölla","bräcke","burlöv","båstad","dals-ed","danderyd","degerfors","dorotea","eda","ekerö","eksjö","emmaboda","enköpings","eskilstuna","eslövs","essunga","fagersta","falkenberg","falköping","falu","filipstad","finspång","flen","forshaga","färgelanda","gagnef","gislaved","gnesta","gnosjö","gotland","grum","grästorp","gullspång","gällivare","gävle","göteborg","götene","habo","hagfor","hallsberg","hallstahammar","halmstad","hammarö","haninge","haparanda","heby","hedemora","helsingborg","herrljunga","hjo","hofor","huddinge","hudiksvall","hultsfred","hylte","håbo","hällefor","härjedalen","härnösand","härryda","hässleholm","höganäs","högsby","hörby","höör","jokkmokk","järfälla","jönköping","kalix","kalmar","karlsborg","karlshamn","karlskoga","karlskrona","karlstad","katrineholm","kil","kinda","kiruna","klippan","knivsta","kramfors","kristianstad","kristinehamn","krokoms","kumla","kungsbacka","kungsör","kungälv","kävlinge","köping","laholm","landskrona","laxå","lekeberg","leksand","lerum","lessebo","lidingö","lidköping","lilla edets","lindesbergs","linköpings","ljungby","ljusdals","ljusnarsbergs","lomma","ludvika","luleå","lunds","lycksele","lysekil","malmö","malung-sälen","malå","mariestad","marks","markaryd","mellerud","mjölby","mora","motala","mullsjö","munkedal","munkfors","mölndal","mönsterås","mörbylånga","nacka","nora","norberg","nordanstig","nordmaling","norrköping","norrtälje","norsjö","nybro","nykvarn","nyköping","nynäshamn","nässjö","ockelbo","olofström","orsa","orust","osby","oskarshamn","ovanåker","oxelösund","pajala","partille","perstorp","piteå","ragunda","robertsfors","ronneby","rättvik","sala","salem","sandviken","sigtuna","simrishamn","sjöbo","skara","skellefteå","skinnskatteberg","skurup","skövde","smedjebacken","sollefteå","sollentuna","solna","sorsele","sotenäs","staffanstorp","stenungsund","stockholm","storfors","storuman","strängnäs","strömstad","strömsund","sundbyberg","sundsvall","sunne","surahammar","svalöv","svedala","svenljunga","säffle","säter","sävsjö","söderhamns","söderköping","södertälje","sölvesborg","tanum","tibro","tidaholm","tierp","timrå","tingsryd","tjörn","tomelilla","torsby","torså","tranemo","tranå","trelleborg","trollhättan","trosa","tyresö","täby","töreboda","uddevalla","ulricehamns","umeå","upplands väsby","upplands-bro","uppsala","uppvidinge","vadstena","vaggeryd","valdemarsvik","vallentuna","vansbro","vara","varberg","vaxholm","vellinge","vetlanda","vilhelmina","vimmerby","vindeln","vingåker","vårgårda","vänersborg","vännäs","värmdö","värnamo","västervik","västerås","växjö","ydre","ystad","åmål","ånge","åre","årjäng","åsele","åstorp","åtvidaberg","älmhult","älvdalen","älvkarleby","älvsbyn","ängelholm","öckerö","ödeshög","örebro","örkelljunga","örnsköldsvik","östersund","österåker","östhammar","östra göinge","överkalix","övertorneå"]}),a.formUtils.addValidator({name:"swephone",validatorFunction:function(a){var b=a.match(/\+/g),c=a.match(/-/g);return!(null!==b&&b.length>1||null!==c&&c.length>1)&&((null===b||0===a.indexOf("+"))&&(a=a.replace(/([-|\+])/g,""),a.length>8&&null===a.match(/[^0-9]/g)))},errorMessage:"",errorMessageKey:"badTelephone"}),a.formUtils.addValidator({name:"swemobile",validatorFunction:function(b){if(!a.formUtils.validators.validate_swephone.validatorFunction(b))return!1;b=b.replace(/[^0-9]/g,"");var c=b.substring(0,3);return(10===b.length||"467"===c)&&((11===b.length||"467"!==c)&&(/07[0-9{1}]/.test(c)||"467"===c))},errorMessage:"",errorMessageKey:"badTelephone"});var c=function(b){var c=[];return a.each(b,function(a,b){c.push(b.substr(0,1).toUpperCase()+b.substr(1,b.length))}),c.sort(),c};a.fn.suggestSwedishCounty=function(b){var d=c(a.formUtils.validators.validate_swecounty.counties);return a.formUtils.suggest(this,d,b)},a.fn.suggestSwedishMunicipality=function(b){var d=c(a.formUtils.validators.validate_swemunicipality.municipalities);return a.formUtils.suggest(this,d,b)}}(a,window)}); \ No newline at end of file +!function(a,b){"function"==typeof define&&define.amd?define(["jquery"],function(a){return b(a)}):"object"==typeof module&&module.exports?module.exports=b(require("jquery")):b(a.jQuery)}(this,function(a){!function(a,b){a.formUtils.registerLoadedModule("sweden"),a.formUtils.addValidator({name:"swesec",validatorFunction:function(c,d){var e,f,g,h;if(d.valAttr("use-hyphen")){if(h=c.split("-"),2!==h.length)return!1;c=h.join("")}if(!c.match(/^(\d{4})(\d{2})(\d{2})(\d{4})$/))return!1;e=RegExp.$1,f=a.formUtils.parseDateInt(RegExp.$2),g=a.formUtils.parseDateInt(RegExp.$3);var i=parseInt(RegExp.$4.substring(2,3))%2===0?"female":"male";d.trigger("genderDerived",[i]),b.ssnGender=i;var j=[31,28,31,30,31,30,31,31,30,31,30,31];if((e%400===0||e%4===0&&e%100!==0)&&(j[1]=29),f<1||f>12||g<1||g>j[f-1])return!1;c=c.substring(2,c.length);for(var k="",l=0;l-1},errorMessage:"",errorMessageKey:"badCustomVal",counties:["stockholms län","uppsala län","södermanlands län","östergötlands län","jönköpings län","kronobergs län","kalmar län","gotlands län","blekinge län","skåne län","hallands län","västra götalands län","värmlands län","örebro län","västmanlands län","dalarnas län","gävleborgs län","västernorrlands län","jämtlands län","västerbottens län","norrbottens län"]}),a.formUtils.addValidator({name:"swemunicipality",validatorFunction:function(b){return b=b.toLowerCase(),a.inArray(b,this.municipalities)!==-1||("s kommun"===b.substr(-8)&&a.inArray(b.substr(0,b.length-8),this.municipalities)>-1||" kommun"===b.substr(-7)&&a.inArray(b.substr(0,b.length-7),this.municipalities)>-1)},errorMessage:"",errorMessageKey:"badCustomVal",municipalities:["ale","alingsås","alvesta","aneby","arboga","arjeplog","arvidsjaur","arvika","askersund","avesta","bengtsfors","berg","bjurholm","bjuv","boden","bollebygd","bollnäs","borgholm","borlänge","borås","botkyrka","boxholm","bromölla","bräcke","burlöv","båstad","dals-ed","danderyd","degerfors","dorotea","eda","ekerö","eksjö","emmaboda","enköpings","eskilstuna","eslövs","essunga","fagersta","falkenberg","falköping","falu","filipstad","finspång","flen","forshaga","färgelanda","gagnef","gislaved","gnesta","gnosjö","gotland","grum","grästorp","gullspång","gällivare","gävle","göteborg","götene","habo","hagfor","hallsberg","hallstahammar","halmstad","hammarö","haninge","haparanda","heby","hedemora","helsingborg","herrljunga","hjo","hofor","huddinge","hudiksvall","hultsfred","hylte","håbo","hällefor","härjedalen","härnösand","härryda","hässleholm","höganäs","högsby","hörby","höör","jokkmokk","järfälla","jönköping","kalix","kalmar","karlsborg","karlshamn","karlskoga","karlskrona","karlstad","katrineholm","kil","kinda","kiruna","klippan","knivsta","kramfors","kristianstad","kristinehamn","krokoms","kumla","kungsbacka","kungsör","kungälv","kävlinge","köping","laholm","landskrona","laxå","lekeberg","leksand","lerum","lessebo","lidingö","lidköping","lilla edets","lindesbergs","linköpings","ljungby","ljusdals","ljusnarsbergs","lomma","ludvika","luleå","lunds","lycksele","lysekil","malmö","malung-sälen","malå","mariestad","marks","markaryd","mellerud","mjölby","mora","motala","mullsjö","munkedal","munkfors","mölndal","mönsterås","mörbylånga","nacka","nora","norberg","nordanstig","nordmaling","norrköping","norrtälje","norsjö","nybro","nykvarn","nyköping","nynäshamn","nässjö","ockelbo","olofström","orsa","orust","osby","oskarshamn","ovanåker","oxelösund","pajala","partille","perstorp","piteå","ragunda","robertsfors","ronneby","rättvik","sala","salem","sandviken","sigtuna","simrishamn","sjöbo","skara","skellefteå","skinnskatteberg","skurup","skövde","smedjebacken","sollefteå","sollentuna","solna","sorsele","sotenäs","staffanstorp","stenungsund","stockholm","storfors","storuman","strängnäs","strömstad","strömsund","sundbyberg","sundsvall","sunne","surahammar","svalöv","svedala","svenljunga","säffle","säter","sävsjö","söderhamns","söderköping","södertälje","sölvesborg","tanum","tibro","tidaholm","tierp","timrå","tingsryd","tjörn","tomelilla","torsby","torså","tranemo","tranå","trelleborg","trollhättan","trosa","tyresö","täby","töreboda","uddevalla","ulricehamns","umeå","upplands väsby","upplands-bro","uppsala","uppvidinge","vadstena","vaggeryd","valdemarsvik","vallentuna","vansbro","vara","varberg","vaxholm","vellinge","vetlanda","vilhelmina","vimmerby","vindeln","vingåker","vårgårda","vänersborg","vännäs","värmdö","värnamo","västervik","västerås","växjö","ydre","ystad","åmål","ånge","åre","årjäng","åsele","åstorp","åtvidaberg","älmhult","älvdalen","älvkarleby","älvsbyn","ängelholm","öckerö","ödeshög","örebro","örkelljunga","örnsköldsvik","östersund","österåker","östhammar","östra göinge","överkalix","övertorneå"]}),a.formUtils.addValidator({name:"swephone",validatorFunction:function(a){var b=a.match(/\+/g),c=a.match(/-/g);return!(null!==b&&b.length>1||null!==c&&c.length>1)&&((null===b||0===a.indexOf("+"))&&(a=a.replace(/([-|\+])/g,""),a.length>8&&null===a.match(/[^0-9]/g)))},errorMessage:"",errorMessageKey:"badTelephone"}),a.formUtils.addValidator({name:"swemobile",validatorFunction:function(b){if(!a.formUtils.validators.validate_swephone.validatorFunction(b))return!1;b=b.replace(/[^0-9]/g,"");var c=b.substring(0,3);return(10===b.length||"467"===c)&&((11===b.length||"467"!==c)&&(/07[0-9{1}]/.test(c)||"467"===c))},errorMessage:"",errorMessageKey:"badTelephone"});var c=function(b){var c=[];return a.each(b,function(a,b){c.push(b.substr(0,1).toUpperCase()+b.substr(1,b.length))}),c.sort(),c};a.fn.suggestSwedishCounty=function(b){var d=c(a.formUtils.validators.validate_swecounty.counties);return a.formUtils.suggest(this,d,b)},a.fn.suggestSwedishMunicipality=function(b){var d=c(a.formUtils.validators.validate_swemunicipality.municipalities);return a.formUtils.suggest(this,d,b)}}(a,window)}); \ No newline at end of file diff --git a/form-validator/toggleDisabled.js b/form-validator/toggleDisabled.js index 3a3e9f9..38bd9aa 100644 --- a/form-validator/toggleDisabled.js +++ b/form-validator/toggleDisabled.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/form-validator/uk.js b/form-validator/uk.js index 97389e9..ad5cd17 100644 --- a/form-validator/uk.js +++ b/form-validator/uk.js @@ -1,7 +1,7 @@ /** File generated by Grunt -- do not modify * JQUERY-FORM-VALIDATOR * - * @version 2.3.74 + * @version 2.3.79 * @website http://formvalidator.net/ * @author Victor Jonsson, http://victorjonsson.se * @license MIT diff --git a/formvalidator.jquery.json b/formvalidator.jquery.json index b4cdded..3507aa1 100644 --- a/formvalidator.jquery.json +++ b/formvalidator.jquery.json @@ -7,7 +7,7 @@ "validation", "validator" ], - "version": "2.3.74", + "version": "2.3.79", "author": { "name": "Victor Jonsson", "url": "http://victorjonsson.se", diff --git a/package.json b/package.json index e9367cd..dd540de 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "jquery-form-validator", "description": "With this feature rich jQuery plugin it becomes easy to validate user input while keeping your HTML markup clean from javascript code. Even though this plugin has a wide range of validation functions it's designed to require as little bandwidth as possible. This is achieved by grouping together validation functions in \"modules\", making it possible for the programmer to load only those functions that's needed to validate a particular form.", - "version": "2.3.74", + "version": "2.3.79", "main": "./form-validator/jquery.form-validator.min.js", "keywords": [ "form", @@ -36,10 +36,11 @@ "grunt-contrib-watch": "^0.6.1", "grunt-umd": "~2.4.0", "numeral": "~1.5.3", - "qunitjs": "^1.20.0" + "qunitjs": "^1.20.0", + "jquery": "2.2.4" }, "dependencies": { - "jquery": ">1.8.0" + "jquery": "2.2.4" }, "scripts": { "prepublish": "grunt prepublish", diff --git a/src/lang/ka.js b/src/lang/ka.js new file mode 100644 index 0000000..eb42c13 --- /dev/null +++ b/src/lang/ka.js @@ -0,0 +1,69 @@ +/** + * jQuery Form Validator + * ------------------------------------------ + * + * Georgian language package + * + * @website http://formvalidator.net/ + * @license MIT + */ +(function($, window) { + + 'use strict'; + + $.formUtils.registerLoadedModule('lang/ka'); + + $(window).bind('validatorsLoaded', function() { + + $.formUtils.LANG = { + errorTitle: 'ფორმა ვერ გაიგზავნა!', + requiredField: 'ველის შევსება სავალდებულოა', + requiredFields: 'თქვენ არ შეგივსიათ ყველა სავალდებულო ველი', + badTime: 'თქვენ მიუთითეთ არასწორი დრო', + badEmail: 'თქვენ მიუთითეთ არასწორი ელ.ფოსტის მისამართი', + badTelephone: 'თქვენ მიუთითეთ არასწორი ტელეფონის ნომერი', + badSecurityAnswer: 'თქვენ გაეცით არასწორი პასუხი უსაფრთხოების კითხვას', + badDate: 'თქვენ მიუთითეთ არასწორი თარიღი', + lengthBadStart: 'ველის მნიშვნელობის სიგრძე უნდა იყოს ', + lengthBadEnd: ' შუალედში', + lengthTooLongStart: 'ველის მნიშვნელობის სიგრძე უნდა იყოს მაქსიმუმ ', + lengthTooShortStart: 'ველის მნიშვნელობის სიგრძე უნდა იყოს მინიმუმ ', + notConfirmed: 'ველის მნიშვნელობები ვერ დადასტურდა', + badDomain: 'არასწორი დომენის მისამართი', + badUrl: 'ველის მნიშვნელობა არ არის მართებული URL მისამართი', + badCustomVal: 'ველის მნიშვნელობა არ არის მართებული', + andSpaces: ' და გამოტოვებები ', + badInt: 'ველის მნიშვნელობა არ არის მართებული რიცხვი', + badStrength: 'პაროლი არ არის საკმარისად ძლიერი (კარგი)', + badNumberOfSelectedOptionsStart: 'თქვენ უნდა აირჩიოთ სულ მცირე ', + badNumberOfSelectedOptionsEnd: ' პასუხი', + badAlphaNumeric: 'ველის მნიშვნელობა უნდა შეიცავდეს მხოლოდ ციფრებსა და ასოებს ', + badAlphaNumericExtra: ' და ', + wrongFileSize: 'ფაილი, რომლის ატვირთვასაც ცდილობთ არის ძალიან დიდი (დასაშვებია მაქსიმუმ %s)', + wrongFileType: 'დასაშვებია მხოლოდ შემდეგი გაფართოების ფაილები: %s', + groupCheckedRangeStart: 'გთხოვთ, აირჩიოთ ', + groupCheckedTooFewStart: 'გთხოვთ, აირჩიოთ სულ მცირე ', + groupCheckedTooManyStart: 'გთხოვთ, აირჩიოთ მაქსიმუმ ', + groupCheckedEnd: ' პუნქტი', + badCreditCard: 'საკრედიტო ბარათის ნომერი არ არის მართებული', + badCVV: 'CVV კოდი არ არის მართებული', + wrongFileDim: 'არამართებული სურათის ზომები,', + imageTooTall: 'სურათი არ უნდა იყოს უფრო გრძელი ვიდრე', + imageTooWide: 'სურათი არ უნდა იყოს უფრო ფართე ვიდრე', + imageTooSmall: 'სურათი არის ძალიან პატარა', + min: 'მინიმუმ', + max: 'მაქსიმუმ', + imageRatioNotAccepted: 'სურათის სიგრძისა და სიგანის ეს თანაფარდობა დაუშვებელია', + badBrazilTelephoneAnswer: 'მითითებული ტელეფონის ნომერი არ არის მართებული', + badreCaptcha: 'დაადასტურეთ, რომ არ ხართ რობოტი', + passwordComplexityStart: 'პაროლი უნდა შეიცავდეს მინიმუმ ', + passwordComplexitySeparator: ', ', + passwordComplexityUppercaseInfo: ' დიდი ასო(ები)', + passwordComplexityLowercaseInfo: ' პატარა ასო(ები)', + passwordComplexitySpecialCharsInfo: ' სპეციალური სიმბოლო(ები)', + passwordComplexityNumericCharsInfo: ' რიცხვითი მნიშვნელობა(ები)', + passwordComplexityEnd: '.' + }; + }); + +})(jQuery, window); diff --git a/src/main/dialogs.js b/src/main/dialogs.js index 1fc9443..1747812 100644 --- a/src/main/dialogs.js +++ b/src/main/dialogs.js @@ -32,11 +32,13 @@ return $($elem.valAttr('error-msg-container')); } else { var $parent = $elem.parent(); - if (!$parent.hasClass('form-group') && !$parent.closest('form').hasClass('form-horizontal')) { - var $formGroup = $parent.closest('.form-group'); - if ($formGroup.length) { - return $formGroup.eq(0); - } + if($elem.attr('type') === 'checkbox' && $elem.closest('.checkbox').length) { + $parent = $elem.closest('.checkbox').parent(); + } else if($elem.attr('type') === 'radio' && $elem.closest('.radio').length) { + $parent = $elem.closest('.radio').parent(); + } + if($parent.closest('.input-group').length) { + $parent = $parent.closest('.input-group').parent(); } return $parent; } diff --git a/src/main/jquery-plugins.js b/src/main/jquery-plugins.js index c3aa1d0..e0aa610 100644 --- a/src/main/jquery-plugins.js +++ b/src/main/jquery-plugins.js @@ -56,6 +56,10 @@ * * @return {jQuery} */ $.fn.validateOnEvent = function (language, config) { + if(this.length === 0) { + return; + } + var $elements = this[0].nodeName === 'FORM' ? this.find('*[data-validation-event]') : this; $elements .each(function () { diff --git a/src/main/utils.js b/src/main/utils.js index 95b102b..0caf1ca 100644 --- a/src/main/utils.js +++ b/src/main/utils.js @@ -46,6 +46,11 @@ */ validators: {}, + /** + * Available sanitizers + */ + sanitizers: {}, + /** * Events triggered by form validator */ @@ -72,6 +77,14 @@ this.validators[name] = validator; }, + /** + * Function for adding a sanitizer + * @param {Object} sanitizer + */ + addSanitizer: function (sanitizer) { + this.sanitizers[sanitizer.name] = sanitizer; + }, + /** * Warn user via the console if available */ diff --git a/src/modules/color.js b/src/modules/color.js new file mode 100644 index 0000000..938dbab --- /dev/null +++ b/src/modules/color.js @@ -0,0 +1,254 @@ +/** + * jQuery Form Validator Module: Color + * ------------------------------------------ + * Created by dszymczuk + * + * + * This form validation module adds validators for some color formats like: hex, rgb, rgba, hsl, hsla. + * Also it allow to use transparent as color + * This module adds the following validators: + * - color + * + * @license MIT + */ +(function($) { + + $.formUtils.registerLoadedModule('color'); + + /* + HELPER FUNCTIONS + */ + var filterFloat = function(value) { + if (/^(\-|\+)?([0-9]+(\.[0-9]+)?|Infinity)$/ + .test(value)) { + return Number(value); + } + + return NaN; + }; + + var isBetween0and1 = function(value) { + return value > 0 && value < 1; + }; + + // workaround for PhantomJS + // https://github.com/ariya/phantomjs/issues/14014 + // can't use Number.isInteger + var isInteger = function(value) { + return Math.floor(value) === value && $.isNumeric(value); + }; + + /** + * Check HEX format + */ + $.formUtils.addValidator({ + name: 'hex', + validatorFunction: function(val, $el) { + if ($el.valAttr('allow-transparent') === 'true' && val === 'transparent') { + return true; + } + + var startWithHex = val[0] === '#'; + if (!startWithHex) { + return false; + } + + var isCorrectLength = val.length === 4 || val.length === 7; + + if (isCorrectLength) { + var regex = /[0-9a-f]/i; + var valueSliced = val.slice(1).split(''); + var isValid = true; + valueSliced.forEach(function(i) { + if (i.match(regex) === null) { + isValid = false; + } + }); + return isValid; + } + + return false; + }, + errorMessage: '', + errorMessageKey: 'badHex' + }); + + /** + * Check RGB format + */ + $.formUtils.addValidator({ + name: 'rgb', + validatorFunction: function(val, $el) { + if ($el.valAttr('allow-transparent') === 'true' && val === 'transparent') { + return true; + } + + var removedSpace = val.replace(/ /g, ''); + var regex = /rgb\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3}\)/i; + + if (removedSpace.match(regex)) { + var removeRgbCall = removedSpace.replace(/rgb/g, ''); + var removeBrackets = removeRgbCall.replace(/\(/g, '').replace(/\)/g, ''); + var valueSliced = removeBrackets.split(','); + var isValid = true; + + valueSliced.forEach(function(i) { + var parsedInt = parseInt(i, 10); + if ((isInteger(parsedInt) && 0 <= parsedInt && parsedInt <= 255) === false) { + isValid = false; + } + }); + return isValid; + } + + return false; + }, + errorMessage: '', + errorMessageKey: 'badRgb' + }); + + /** + * Check RGBA format + */ + $.formUtils.addValidator({ + name: 'rgba', + validatorFunction: function(val, $el) { + if ($el.valAttr('allow-transparent') === 'true' && val === 'transparent') { + return true; + } + + var removedSpace = val.replace(/ /g, ''); + var regex = /rgba\([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0,1]?.?[0-9]*\)/i; + + if (removedSpace.match(regex)) { + var removeRgbaCall = removedSpace.replace(/rgba/g, ''); + var removeBrackets = removeRgbaCall.replace(/\(/g, '').replace(/\)/g, ''); + var valueSliced = removeBrackets.split(','); + var isValid = true; + + valueSliced.forEach(function(i, index) { + var value = filterFloat(i); + if (isInteger(value)) { + var isInRange = value >= 0 && value <= 255; + if (!isInRange) { + isValid = false; + } + + if (isValid && index === 3) { + isValid = value >= 0 && value < 2; + } + } else if (!isBetween0and1(i)) { + isValid = false; + } + }); + return isValid; + } + + return false; + }, + errorMessage: '', + errorMessageKey: 'badRgba' + }); + + /** + * Check HSL format + */ + $.formUtils.addValidator({ + name: 'hsl', + validatorFunction: function(val, $el) { + if ($el.valAttr('allow-transparent') === 'true' && val === 'transparent') { + return true; + } + + var removedSpace = val.replace(/ /g, ''); + var regex = /hsl\(-?[0-9]{1,3},[0-9]{1,3}%,[0-9]{1,3}%\)/i; + + if (removedSpace.match(regex)) { + var removeHslCall = removedSpace.replace(/hsl/g, ''); + var removeBrackets = removeHslCall.replace(/\(/g, '').replace(/\)/g, ''); + var valueSliced = removeBrackets.split(','); + var isValid = true; + + valueSliced.forEach(function(i, index) { + var parsedInt = parseInt(i, 10); + + if (isInteger(parsedInt)) { + if (index !== 0) { + var isInRange = parsedInt >= 0 && parsedInt <= 100; + if (!isInRange) { + isValid = false; + } + } + } else { + isValid = false; + } + }); + return isValid; + } + + return false; + }, + errorMessage: '', + errorMessageKey: 'badHsl' + }); + + /** + * Check HSLA format + */ + $.formUtils.addValidator({ + name: 'hsla', + validatorFunction: function(val, $el) { + if ($el.valAttr('allow-transparent') === 'true' && val === 'transparent') { + return true; + } + + var isInRange; + var removedSpace = val.replace(/ /g, ''); + var regex = /hsla\(-?[0-9]{1,3},[0-9]{1,3}%,[0-9]{1,3}%,[0,1]?.?[0-9]*\)/i; + + if (removedSpace.match(regex)) { + var removeHslaCall = removedSpace.replace(/hsla/g, ''); + var removeBrackets = removeHslaCall.replace(/\(/g, '').replace(/\)/g, ''); + var valueSliced = removeBrackets.split(','); + var isValid = true; + + valueSliced.forEach(function(i, index) { + var value = filterFloat(i); + var parsedInt = parseInt(i, 10); + + if (isInteger(value)) { + if (index !== 0 && index !== 3) { + isInRange = value >= 0 && value <= 100; + if (!isInRange) { + isValid = false; + } + } + + if (isValid && index === 3) { + isValid = value >= 0 && value < 2; + } + } else if (isNaN(value) && isInteger(parsedInt)) { + isInRange = parsedInt >= 0 && parsedInt <= 100; + if (!isInRange) { + isValid = false; + } + } else { + value = filterFloat(Number(i).toFixed(20)); + + isInRange = value >= 0 && value <= 1; + if (!isInRange) { + isValid = false; + } + } + }); + + return isValid; + } + + return false; + }, + errorMessage: '', + errorMessageKey: 'badHsla' + }); + +})(jQuery); diff --git a/src/modules/date.js b/src/modules/date.js index 832c3f5..19b661f 100644 --- a/src/modules/date.js +++ b/src/modules/date.js @@ -61,6 +61,8 @@ age = getAge(year, month, day), allowedAgeRange = ($el.valAttr('age-range') || '0-124').split('-'); + $el.trigger('ageCalculated', [age]); + if (allowedAgeRange.length !== 2 || !$.isNumeric(allowedAgeRange[0]) || !$.isNumeric(allowedAgeRange[1])) { throw new Error('Date range format invalid'); } @@ -71,14 +73,30 @@ errorMessageKey: 'badDate' }); - function getAge(otherDateYear, otherDateMonth, otherDateDay) { - var otherDate = new Date(), - nowDate = new Date(); - otherDate.setYear(otherDateYear); - otherDate.setMonth(otherDateMonth); - otherDate.setDate(otherDateDay); - return new Date(nowDate.getTime() - otherDate.getTime()).getUTCFullYear() - 1970; + var birthDate = new Date(otherDateYear, otherDateMonth, otherDateDay), now = new Date(), + years = now.getFullYear() - birthDate.getFullYear(); + birthDate.setFullYear(birthDate.getFullYear() + years); + if (birthDate > now) { + years--; + birthDate.setFullYear(birthDate.getFullYear() - 1); + } + var days = Math.floor((now.getTime() - birthDate.getTime()) / (3600 * 24 * 1000)), + yearsOld = years + days / (isLeapYear(now.getFullYear()) ? 366 : 365), + decimals = ((yearsOld + '').split('.')[1] || '').substr(0, 3); + + if (yearsOld >= 0) { + return Math.floor(yearsOld) + (decimals >= 915 ? 1:0); + } else { + decimals *= 10; + return Math.floor(yearsOld) + (decimals <= 840 ? 1:0); + } + } + + function isLeapYear(year) { + var d = new Date(year, 1, 28); + d.setDate(d.getDate() + 1); + return d.getMonth() === 1; } })(jQuery); diff --git a/src/modules/file.js b/src/modules/file.js index 5fdfb83..47e03d6 100644 --- a/src/modules/file.js +++ b/src/modules/file.js @@ -25,7 +25,7 @@ * @return {Array} */ _getTypes = function($input) { - var allowedTypes = $.split( ($input.valAttr('allowing') || '').toLowerCase() ); + var allowedTypes = ($input.valAttr('allowing') || '').toLowerCase().split(/,\s*/); if ($.inArray('jpg', allowedTypes) > -1 && $.inArray('jpeg', allowedTypes) === -1) { allowedTypes.push('jpeg'); } diff --git a/src/modules/sanitize.js b/src/modules/sanitize.js index 6a5e569..4934da0 100644 --- a/src/modules/sanitize.js +++ b/src/modules/sanitize.js @@ -28,70 +28,112 @@ 'use strict'; - $.formUtils.registerLoadedModule('sanitize'); - - var inputsThatCantBeSanitized = '[type="button"], [type="submit"], [type="radio"], [type="checkbox"], [type="reset"], [type="search"]', - sanitizeCommands = { - upper : function(val) { - return val.toLocaleUpperCase(); - }, - lower : function(val) { - return val.toLocaleLowerCase(); - }, - trim : function(val) { - return $.trim(val); - }, - trimLeft : function(val) { - return val.replace(/^\s+/,''); - }, - trimRight : function(val) { - return val.replace(/\s+$/,''); - }, - capitalize : function(val) { - var words = val.split(' '); + $.formUtils.addSanitizer({ + name : 'upper', + sanitizerFunction : function(val) { + return val.toLocaleUpperCase(); + } + }); + + $.formUtils.addSanitizer({ + name : 'lower', + sanitizerFunction : function(val) { + return val.toLocaleLowerCase(); + } + }); + + $.formUtils.addSanitizer({ + name : 'trim', + sanitizerFunction : function(val) { + return $.trim(val); + } + }); + + $.formUtils.addSanitizer({ + name : 'trimLeft', + sanitizerFunction : function(val) { + return val.replace(/^\s+/,''); + } + }); + + $.formUtils.addSanitizer({ + name : 'trimRight', + sanitizerFunction : function(val) { + return val.replace(/\s+$/,''); + } + }); + + $.formUtils.addSanitizer({ + name : 'capitalize', + sanitizerFunction : function(val) { + var words = val.split(' '); $.each(words, function(i, word) { words[i] = word.substr(0,1).toUpperCase() + word.substr(1, word.length); }); return words.join(' '); - }, - insert : function(val, $input, pos) { + } + }); + + $.formUtils.addSanitizer({ + name : 'insert', + sanitizerFunction : function(val, $input, pos) { var extra = ($input.attr('data-sanitize-insert-'+pos) || '').replace(/\[SPACE\]/g, ' '); if ( (pos === 'left' && val.indexOf(extra) === 0) || (pos === 'right' && val.substring(val.length - extra.length) === extra)) { return val; } return (pos === 'left' ? extra:'') + val + (pos === 'right' ? extra : ''); - }, - insertRight : function(val, $input) { - return this.insert(val, $input, 'right'); - }, - insertLeft : function(val, $input) { - return this.insert(val, $input, 'left'); - }, - numberFormat : function(val, $input) { - if (val.length === 0) { - return val; - } - if ( 'numeral' in window ) { - //If this has been previously formatted, it needs to be unformatted first before being reformatted. - //Else numeral will fail - val = numeral().unformat(val); - val = numeral(val).format( $input.attr('data-sanitize-number-format') ); - } - else { - throw new ReferenceError('Using sanitation function "numberFormat" requires that you include numeral.js ' + - '(http://numeraljs.com/)'); - } - return val; - }, - strip: function(val, $input) { - var toRemove = $input.attr('data-sanitize-strip') || ''; - $.split(toRemove, function(char) { - var regex = new RegExp($.isNumeric(char) ? char : '\\'+char, 'g'); - val = val.replace(regex, ''); - }); - return val; - }, - escape : function(val, $input) { + } + }); + + $.formUtils.addSanitizer({ + name : 'insertRight', + sanitizerFunction : function(val, $input) { + return $.formUtils.sanitizers.insert.sanitizerFunction(val, $input, 'right'); + } + }); + + $.formUtils.addSanitizer({ + name : 'insertLeft', + sanitizerFunction : function(val, $input) { + return $.formUtils.sanitizers.insert.sanitizerFunction(val, $input, 'left'); + } + }); + + $.formUtils.addSanitizer({ + name : 'numberFormat', + sanitizerFunction : function(val, $input) { + if (val.length === 0) { + return val; + } + if ( 'numeral' in window ) { + //If this has been previously formatted, it needs to be unformatted first before being reformatted. + //Else numeral will fail + val = numeral().unformat(val); + val = numeral(val).format( $input.attr('data-sanitize-number-format') ); + } + else { + throw new ReferenceError('Using sanitation function "numberFormat" requires that you include numeral.js ' + + '(http://numeraljs.com/)'); + } + return val; + } + }); + + $.formUtils.addSanitizer({ + name : 'strip', + sanitizerFunction : function(val, $input) { + var toRemove = $input.attr('data-sanitize-strip') || ''; + $.split(toRemove, function(char) { + var regex = new RegExp($.isNumeric(char) ? char : '\\'+char, 'g'); + val = val.replace(regex, ''); + }); + return val; + } + }); + + $.formUtils.addSanitizer({ + name : 'escape', + sanitizerFunction : function(val, $input) { var isEscaped = $input.valAttr('is-escaped'), entities = { '<' : '__%AMP%__lt;', @@ -117,27 +159,35 @@ }); return val.replace(new RegExp('__\%AMP\%__', 'g'), '&'); - } - }, + } + }); + + $.formUtils.registerLoadedModule('sanitize'); + + var inputsThatCantBeSanitized = '[type="button"], [type="submit"], [type="radio"], [type="checkbox"], [type="reset"], [type="search"]', setupSanitation = function(evt, $forms, config) { if ( !$forms ) { $forms = $('form'); } - if ( !$forms.each ) { + if ( !$forms.each ) { $forms = $($forms); } var execSanitationCommands = function() { + var $input = $(this), value = $input.val(); - $.split($input.attr('data-sanitize'), function(command) { - if ( command in sanitizeCommands ) { - value = sanitizeCommands[command](value, $input, config); - } - else { + $.split($input.attr('data-sanitize'), function(command) { + + var sanitizer = $.formUtils.sanitizers[command]; + + if (sanitizer) { + value = sanitizer.sanitizerFunction(value, $input, config); + } else { throw new Error('Use of unknown sanitize command "'+command+'"'); } + }); $input .val(value) diff --git a/src/modules/sweden.js b/src/modules/sweden.js index 923712d..5cf387c 100644 --- a/src/modules/sweden.js +++ b/src/modules/sweden.js @@ -44,7 +44,11 @@ month = $.formUtils.parseDateInt(RegExp.$2); day = $.formUtils.parseDateInt(RegExp.$3); - window.ssnGender = ( parseInt((RegExp.$4).substring(2, 3)) % 2 ) === 0 ? 'female' : 'male'; + var ssnGender = ( parseInt((RegExp.$4).substring(2, 3)) % 2 ) === 0 ? 'female' : 'male'; + $input.trigger('genderDerived', [ssnGender]); + + // todo: remove when moving to version 3.0 + window.ssnGender = ssnGender; var months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; if (year % 400 === 0 || year % 4 === 0 && year % 100 !== 0) { diff --git a/test/bootstrap3.html b/test/bootstrap3.html new file mode 100644 index 0000000..f724db1 --- /dev/null +++ b/test/bootstrap3.html @@ -0,0 +1,224 @@ + + + + + Bootstrap 3 Compatibility Test + + + +
    +

    Not Bootstrap form

    +
    +

    Text + +

    +

    Check + CheckBox 1 + CheckBox 2 + CheckBox 3 +

    +

    Select + Radio 1 + Radio 2 + Radio 3 +

    + +
    +
    +

    Basic form

    +
    +
    + + +
    +
    +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +

    Inline form

    +
    +
    + + +
    +
    +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +

    Horizontal form

    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    + +
    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    +
    + + + + + diff --git a/test/form.html b/test/form.html index 01b9d3b..c642d69 100644 --- a/test/form.html +++ b/test/form.html @@ -275,6 +275,10 @@

    Validate on submit

    +
    + + +

    Validation Module: Poland

    errorMessageKey: 'badEvenNumber', }); + // UK Surname Proper Casing + $.formUtils.addSanitizer({ + name : 'proper_case', + sanitizerFunction : function(value) { + value = value.toLocaleLowerCase(); + value = value.substring(0, 1).toUpperCase() + value.substring(1); + intPointer = value.indexOf(' '); + while (intPointer > -1) { + value = value.substring(0, intPointer + 1) + value.substring(intPointer + 1, intPointer + 2).toUpperCase() + value.substring(intPointer + 2); + intPointer = value.indexOf(' ', intPointer + 1); + } + intPointer = value.indexOf('-'); + if (intPointer > -1) + value = value.substring(0, intPointer + 1) + value.substring(intPointer + 1, intPointer + 2).toUpperCase() + value.substring(intPointer + 2); + intPointer = value.indexOf('O\''); + if (intPointer > -1) + value = value.substring(0, intPointer + 2) + value.substring(intPointer + 2, intPointer + 3).toUpperCase() + value.substring(intPointer + 3); + intPointer = value.indexOf('Mc'); + if (intPointer > -1) + value = value.substring(0, intPointer + 2) + value.substring(intPointer + 2, intPointer + 3).toUpperCase() + value.substring(intPointer + 3); + intPointer = value.indexOf('Mac'); + if (intPointer > -1) + value = value.substring(0, intPointer + 3) + value.substring(intPointer + 3, intPointer + 4).toUpperCase() + value.substring(intPointer + 4); + return value; + } + }); + window.applyValidation = function(validateOnBlur, forms, messagePosition, xtraModule) { if( !forms ) forms = 'form'; diff --git a/test/qunit.html b/test/qunit.html index 8248d0e..1f006b6 100644 --- a/test/qunit.html +++ b/test/qunit.html @@ -1124,11 +1124,154 @@ }); }); + test("Color Hex validation", function() { + + clearForm(); + + var links = [ + {val: '#0000FF', isValid: true}, + {val: '#00F', isValid: true}, + {val: '123', isValid: false}, + {val: '112233', isValid: false}, + {val: '#4567', isValid: false}, + {val: input('transparent', {'allow-transparent': 'true'}), isValid: true}, + {val: 'transparent', isValid: false} + ]; + + $.each(links, function(i, obj) { + runTest(obj, 'hex'); + }); + }); + + test("Color Rgb validation", function() { + + clearForm(); + + var links = [ + {val: 'rgb(255,255,255)', isValid: true}, + {val: 'rgb( 255 , 255 , 255 )', isValid: true}, + {val: 'rgb( 255, 255, 255 )', isValid: true}, + {val: 'rgb(255,255,255)', isValid: true}, + + + {val: 'rgb(-10,255,255)', isValid: false}, + {val: '255255255', isValid: false}, + {val: 'rgb(255,255,256)', isValid: false}, + + + {val: input('transparent', {'allow-transparent': 'true'}), isValid: true}, + {val: 'transparent', isValid: false} + ]; + + $.each(links, function(i, obj) { + runTest(obj, 'rgb'); + }); + }); + + test("Color Rgba validation", function() { + + clearForm(); + + var links = [ + {val: 'rgba(255,255,255,1)', isValid: true}, + {val: 'rgba( 255 , 255 , 255 , 1 )', isValid: true}, + {val: 'rgba( 255 , 255 , 255 , 1 )', isValid: true}, + {val: 'rgba(255,255,255,1)', isValid: true}, + {val: 'rgba(255,255,255,0)', isValid: true}, + {val: 'rgba(255,255,255,1)', isValid: true}, + {val: 'rgba(255,255,255,0.5)', isValid: true}, + {val: 'rgba(255,255,255,.5)', isValid: true}, + {val: 'rgba(255,255,255,.524141)', isValid: true}, + {val: 'rgba(255,255,255,2)', isValid: false}, + {val: 'rgba(255,255,255,-1)', isValid: false}, + {val: 'rgba(255,255,255,1.000000000001)', isValid: false}, + {val: 'rgba(255,255,255,-0.5)', isValid: false}, + {val: 'rgba(255,255,255,2.3)', isValid: false}, + {val: 'rgba(-10,255,255,1)', isValid: false}, + {val: '2552552551', isValid: false}, + {val: 'rgba(255,255,256),1', isValid: false}, + {val: '0000FF', isValid: false}, + {val: input('transparent', {'allow-transparent': 'true'}), isValid: true}, + {val: 'transparent', isValid: false} + ]; + + $.each(links, function(i, obj) { + runTest(obj, 'rgba'); + }); + }); + + test("Color Hsl validation", function() { + + clearForm(); + + var links = [ + {val: 'hsl(120,50%,50%)', isValid: true}, + {val: 'hsl( 120 , 50% , 50% )', isValid: true}, + {val: 'hsl( 120, 50%, 50% )', isValid: true}, + {val: 'hsl(-120,50%,50%)', isValid: true}, + {val: 'hsl(480,50%,50%)', isValid: true}, + + {val: 'hsl(10,-50%,50%)', isValid: false}, + {val: 'hsl(10,50%,-50%)', isValid: false}, + {val: '120,50%,50%', isValid: false}, + {val: 'hsl(120,100%,101%)', isValid: false}, + {val: 'hsl(50%, 50%, 100%)', isValid: false}, + {val: 'hsl(120, 50, 100%)', isValid: false}, + {val: 'hsl(120, 50%, 100)', isValid: false}, + + {val: input('transparent', {'allow-transparent': 'true'}), isValid: true}, + {val: 'transparent', isValid: false} + ]; + + $.each(links, function(i, obj) { + runTest(obj, 'hsl'); + }); + }); + + test("Color Hsla validation", function() { + + clearForm(); + + var links = [ + {val: 'hsla(120,50%,50%,1)', isValid: true}, + {val: 'hsla( 120 , 50% , 50%, 1 )', isValid: true}, + {val: 'hsla( 120, 50%, 50% , 1 )', isValid: true}, + {val: 'hsla(-120,50%,50%,1)', isValid: true}, + {val: 'hsla(480,50%,50%,1)', isValid: true}, + {val: 'hsla(120,50%,100%,0)', isValid: true}, + {val: 'hsla(120,50%,100%,1)', isValid: true}, + {val: 'hsla(120,50%,100%,0.5)', isValid: true}, + {val: 'hsla(120,50%,100%,.5)', isValid: true}, + {val: 'hsla(120,50%,100%,.524141)', isValid: true}, + + {val: 'hsla(120,50%,100%,50%)', isValid: false}, + {val: 'hsla(120,50%,100%,2)', isValid: false}, + {val: 'hsla(120,50%,100%,-1)', isValid: false}, + {val: 'hsla(120,50%,100%,1.000000000001)', isValid: false}, + {val: 'hsla(120,50%,100%,-0.5)', isValid: false}, + {val: 'hsla(120,50%,100%,2.3)', isValid: false}, + {val: 'hsla(10,-50%,50%,1)', isValid: false}, + {val: 'hsla(10,50%,-50%,1)', isValid: false}, + {val: '120,50%,50%,1', isValid: false}, + {val: 'hsla(120,100%,101%,1)', isValid: false}, + {val: 'hsla(50%, 50%, 100%,1)', isValid: false}, + {val: 'hsla(120, 50, 100%,1)', isValid: false}, + {val: 'hsla(120, 50%, 100,1)', isValid: false}, + + {val: input('transparent', {'allow-transparent': 'true'}), isValid: true}, + {val: 'transparent', isValid: false} + ]; + + $.each(links, function(i, obj) { + runTest(obj, 'hsla'); + }); + }); + // TODO: Write more tests... } $.validate({ - modules : 'security, location, sweden, file, date, sanitize, uk, poland', + modules : 'security, location, sweden, file, date, sanitize, uk, poland, color', onModulesLoaded: function( $form ) { if( window.console && window.console.log ) console.log('About to run all tests');