Update jquery-validation-unobtrusive (#421)

Addresses #15
This commit is contained in:
Jass Bagga 2018-03-30 15:04:50 -07:00 committed by GitHub
parent 2f9ce959ea
commit ac9addabcc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 3296 additions and 2183 deletions

View File

@ -1,44 +1,15 @@
{ {
"name": "jquery-validation-unobtrusive", "name": "jquery-validation-unobtrusive",
"version": "3.2.6",
"homepage": "https://github.com/aspnet/jquery-validation-unobtrusive", "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
"description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.", "version": "3.2.9",
"main": [ "_release": "3.2.9",
"jquery.validate.unobtrusive.js"
],
"ignore": [
"**/.*",
"*.json",
"*.md",
"*.txt",
"gulpfile.js"
],
"keywords": [
"jquery",
"asp.net",
"mvc",
"validation",
"unobtrusive"
],
"authors": [
"Microsoft"
],
"license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
"repository": {
"type": "git",
"url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
},
"dependencies": {
"jquery-validation": ">=1.8",
"jquery": ">=1.8"
},
"_release": "3.2.6",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v3.2.6", "tag": "v3.2.9",
"commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7" "commit": "a91f5401898e125f10771c5f5f0909d8c4c82396"
}, },
"_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git", "_source": "https://github.com/aspnet/jquery-validation-unobtrusive.git",
"_target": "3.2.6", "_target": "^3.2.9",
"_originalSource": "jquery-validation-unobtrusive" "_originalSource": "jquery-validation-unobtrusive",
"_direct": true
} }

View File

@ -0,0 +1,12 @@
Copyright (c) .NET Foundation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
these files except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

View File

@ -1,12 +1,22 @@
/*! // Unobtrusive validation support library for jQuery and jQuery Validate
** Unobtrusive validation support library for jQuery and jQuery Validate // Copyright (C) Microsoft Corporation. All rights reserved.
** Copyright (C) Microsoft Corporation. All rights reserved. // @version v3.2.9
*/
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
/*global document: false, jQuery: false */ /*global document: false, jQuery: false */
(function ($) { (function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define("jquery.validate.unobtrusive", ['jquery.validation'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports
module.exports = factory(require('jquery-validation'));
} else {
// Browser global
jQuery.validator.unobtrusive = factory(jQuery);
}
}(function ($) {
var $jQval = $.validator, var $jQval = $.validator,
adapters, adapters,
data_validation = "unobtrusiveValidation"; data_validation = "unobtrusiveValidation";
@ -118,7 +128,7 @@
execInContext = function (name, args) { execInContext = function (name, args) {
var func = defaultOptions[name]; var func = defaultOptions[name];
func && $.isFunction(func) && func.apply(form, args); func && $.isFunction(func) && func.apply(form, args);
} };
if (!result) { if (!result) {
result = { result = {
@ -409,8 +419,13 @@
setValidationValues(options, "regex", options.params.regex); setValidationValues(options, "regex", options.params.regex);
} }
}); });
adapters.add("fileextensions", ["extensions"], function (options) {
setValidationValues(options, "extension", options.params.extensions);
});
$(function () { $(function () {
$jQval.unobtrusive.parse(document); $jQval.unobtrusive.parse(document);
}); });
}(jQuery));
return $jQval.unobtrusive;
}));

View File

@ -1,9 +1,9 @@
{ {
"name": "jquery-validation", "name": "jquery-validation",
"homepage": "http://jqueryvalidation.org/", "homepage": "https://jqueryvalidation.org/",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/jzaefferer/jquery-validation.git" "url": "git://github.com/jquery-validation/jquery-validation.git"
}, },
"authors": [ "authors": [
"Jörn Zaefferer <joern.zaefferer@gmail.com>" "Jörn Zaefferer <joern.zaefferer@gmail.com>"
@ -27,14 +27,15 @@
"dependencies": { "dependencies": {
"jquery": ">= 1.7.2" "jquery": ">= 1.7.2"
}, },
"version": "1.14.0", "version": "1.17.0",
"_release": "1.14.0", "_release": "1.17.0",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.14.0", "tag": "1.17.0",
"commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48" "commit": "fc9b12d3bfaa2d0c04605855b896edb2934c0772"
}, },
"_source": "git://github.com/jzaefferer/jquery-validation.git", "_source": "https://github.com/jzaefferer/jquery-validation.git",
"_target": ">=1.8", "_target": "^1.17.0",
"_originalSource": "jquery-validation" "_originalSource": "jquery-validation",
"_direct": true
} }

View File

@ -1,14 +1,16 @@
/*! /*!
* jQuery Validation Plugin v1.14.0 * jQuery Validation Plugin v1.17.0
* *
* http://jqueryvalidation.org/ * https://jqueryvalidation.org/
* *
* Copyright (c) 2015 Jörn Zaefferer * Copyright (c) 2017 Jörn Zaefferer
* Released under the MIT license * Released under the MIT license
*/ */
(function( factory ) { (function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
define( ["jquery", "./jquery.validate"], factory ); define( ["jquery", "./jquery.validate"], factory );
} else if (typeof module === "object" && module.exports) {
module.exports = factory( require( "jquery" ) );
} else { } else {
factory( jQuery ); factory( jQuery );
} }
@ -17,9 +19,11 @@
( function() { ( function() {
function stripHtml( value ) { function stripHtml( value ) {
// remove html tags and space chars
// Remove html tags and space chars
return value.replace( /<.[^<>]*?>/g, " " ).replace( /&nbsp;|&#160;/gi, " " ) return value.replace( /<.[^<>]*?>/g, " " ).replace( /&nbsp;|&#160;/gi, " " )
// remove punctuation
// Remove punctuation
.replace( /[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "" ); .replace( /[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "" );
} }
@ -41,10 +45,11 @@
// Accept a value from a file input based on a required mimetype // Accept a value from a file input based on a required mimetype
$.validator.addMethod( "accept", function( value, element, param ) { $.validator.addMethod( "accept", function( value, element, param ) {
// Split mime on commas in case we have multiple types we can accept // Split mime on commas in case we have multiple types we can accept
var typeParam = typeof param === "string" ? param.replace(/\s/g, "").replace(/,/g, "|") : "image/*", var typeParam = typeof param === "string" ? param.replace( /\s/g, "" ) : "image/*",
optionalValue = this.optional( element ), optionalValue = this.optional( element ),
i, file; i, file, regex;
// Element is optional // Element is optional
if ( optionalValue ) { if ( optionalValue ) {
@ -52,16 +57,23 @@ $.validator.addMethod("accept", function(value, element, param) {
} }
if ( $( element ).attr( "type" ) === "file" ) { if ( $( element ).attr( "type" ) === "file" ) {
// If we are using a wildcard, make it regex friendly
typeParam = typeParam.replace(/\*/g, ".*"); // Escape string to be used in the regex
// see: https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
// Escape also "/*" as "/.*" as a wildcard
typeParam = typeParam
.replace( /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, "\\$&" )
.replace( /,/g, "|" )
.replace( /\/\*/g, "/.*" );
// Check if the element has a FileList before checking each file // Check if the element has a FileList before checking each file
if ( element.files && element.files.length ) { if ( element.files && element.files.length ) {
regex = new RegExp( ".?(" + typeParam + ")$", "i" );
for ( i = 0; i < element.files.length; i++ ) { for ( i = 0; i < element.files.length; i++ ) {
file = element.files[ i ]; file = element.files[ i ];
// Grab the mimetype from the loaded file, verify it matches // Grab the mimetype from the loaded file, verify it matches
if (!file.type.match(new RegExp( "\\.?(" + typeParam + ")$", "i"))) { if ( !file.type.match( regex ) ) {
return false; return false;
} }
} }
@ -90,8 +102,9 @@ $.validator.addMethod("bankaccountNL", function(value, element) {
if ( !( /^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test( value ) ) ) { if ( !( /^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test( value ) ) ) {
return false; return false;
} }
// now '11 check'
var account = value.replace(/ /g, ""), // remove spaces // Now '11 check'
var account = value.replace( / /g, "" ), // Remove spaces
sum = 0, sum = 0,
len = account.length, len = account.length,
pos, factor, digit; pos, factor, digit;
@ -114,49 +127,37 @@ $.validator.addMethod("bankorgiroaccountNL", function(value, element) {
* *
* BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional) * BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional)
* *
* Validation is case-insensitive. Please make sure to normalize input yourself.
*
* BIC definition in detail: * BIC definition in detail:
* - First 4 characters - bank code (only letters) * - First 4 characters - bank code (only letters)
* - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters) * - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters)
* - Next 2 characters - location code (letters and digits) * - Next 2 characters - location code (letters and digits)
* a. shall not start with '0' or '1' * a. shall not start with '0' or '1'
* b. second character must be a letter ('O' is not allowed) or one of the following digits ('0' for test (therefore not allowed), '1' for passive participant and '2' for active participant) * b. second character must be a letter ('O' is not allowed) or digit ('0' for test (therefore not allowed), '1' denoting passive participant, '2' typically reverse-billing)
* - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits) * - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits)
*/ */
$.validator.addMethod( "bic", function( value, element ) { $.validator.addMethod( "bic", function( value, element ) {
return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-2])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value ); return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() );
}, "Please specify a valid BIC code" ); }, "Please specify a valid BIC code" );
/* /*
* Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities * Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities
* Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal * Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal
*/ *
$.validator.addMethod( "cifES", function( value ) { * Spanish CIF structure:
"use strict"; *
* [ T ][ P ][ P ][ N ][ N ][ N ][ N ][ N ][ C ]
var num = [], *
controlDigit, sum, i, count, tmp, secondDigit; * Where:
*
value = value.toUpperCase(); * T: 1 character. Kind of Organization Letter: [ABCDEFGHJKLMNPQRSUVW]
* P: 2 characters. Province.
// Quick format test * N: 5 characters. Secuencial Number within the province.
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { * C: 1 character. Control Digit: [0-9A-J].
return false; *
} * [ T ]: Kind of Organizations. Possible values:
*
for ( i = 0; i < 9; i++ ) {
num[ i ] = parseInt( value.charAt( i ), 10 );
}
// Algorithm for checking CIF codes
sum = num[ 2 ] + num[ 4 ] + num[ 6 ];
for ( count = 1; count < 8; count += 2 ) {
tmp = ( 2 * num[ count ] ).toString();
secondDigit = tmp.charAt( 1 );
sum += parseInt( tmp.charAt( 0 ), 10 ) + ( secondDigit === "" ? 0 : parseInt( secondDigit, 10 ) );
}
/* The first (position 1) is a letter following the following criteria:
* A. Corporations * A. Corporations
* B. LLCs * B. LLCs
* C. General partnerships * C. General partnerships
@ -176,15 +177,82 @@ $.validator.addMethod( "cifES", function( value ) {
* S. Organs of State Administration and regions * S. Organs of State Administration and regions
* V. Agrarian Transformation * V. Agrarian Transformation
* W. Permanent establishments of non-resident in Spain * W. Permanent establishments of non-resident in Spain
*
* [ C ]: Control Digit. It can be a number or a letter depending on T value:
* [ T ] --> [ C ]
* ------ ----------
* A Number
* B Number
* E Number
* H Number
* K Letter
* P Letter
* Q Letter
* S Letter
*
*/ */
if ( /^[ABCDEFGHJNPQRSUVW]{1}/.test( value ) ) { $.validator.addMethod( "cifES", function( value, element ) {
sum += ""; "use strict";
controlDigit = 10 - parseInt( sum.charAt( sum.length - 1 ), 10 );
value += controlDigit; if ( this.optional( element ) ) {
return ( num[ 8 ].toString() === String.fromCharCode( 64 + controlDigit ) || num[ 8 ].toString() === value.charAt( value.length - 1 ) ); return true;
} }
var cifRegEx = new RegExp( /^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi );
var letter = value.substring( 0, 1 ), // [ T ]
number = value.substring( 1, 8 ), // [ P ][ P ][ N ][ N ][ N ][ N ][ N ]
control = value.substring( 8, 9 ), // [ C ]
all_sum = 0,
even_sum = 0,
odd_sum = 0,
i, n,
control_digit,
control_letter;
function isOdd( n ) {
return n % 2 === 0;
}
// Quick format test
if ( value.length !== 9 || !cifRegEx.test( value ) ) {
return false; return false;
}
for ( i = 0; i < number.length; i++ ) {
n = parseInt( number[ i ], 10 );
// Odd positions
if ( isOdd( i ) ) {
// Odd positions are multiplied first.
n *= 2;
// If the multiplication is bigger than 10 we need to adjust
odd_sum += n < 10 ? n : n - 9;
// Even positions
// Just sum them
} else {
even_sum += n;
}
}
all_sum = even_sum + odd_sum;
control_digit = ( 10 - ( all_sum ).toString().substr( -1 ) ).toString();
control_digit = parseInt( control_digit, 10 ) > 9 ? "0" : control_digit;
control_letter = "JABCDEFGHI".substr( control_digit, 1 ).toString();
// Control must be a digit
if ( letter.match( /[ABEH]/ ) ) {
return control === control_digit;
// Control must be a letter
} else if ( letter.match( /[KPQS]/ ) ) {
return control === control_letter;
}
// Can be either
return control === control_digit || control === control_letter;
}, "Please specify a valid CIF number." ); }, "Please specify a valid CIF number." );
@ -193,6 +261,7 @@ $.validator.addMethod( "cifES", function( value ) {
* CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. * CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation.
*/ */
$.validator.addMethod( "cpfBR", function( value ) { $.validator.addMethod( "cpfBR", function( value ) {
// Removing special characters from value // Removing special characters from value
value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" );
@ -209,7 +278,9 @@ $.validator.addMethod("cpfBR", function(value) {
checkResult = function( sum, cn ) { checkResult = function( sum, cn ) {
var result = ( sum * 10 ) % 11; var result = ( sum * 10 ) % 11;
if ((result === 10) || (result === 11)) {result = 0;} if ( ( result === 10 ) || ( result === 11 ) ) {
result = 0;
}
return ( result === cn ); return ( result === cn );
}; };
@ -246,6 +317,47 @@ $.validator.addMethod("cpfBR", function(value) {
}, "Please specify a valid CPF number" ); }, "Please specify a valid CPF number" );
// https://jqueryvalidation.org/creditcard-method/
// based on https://en.wikipedia.org/wiki/Luhn_algorithm
$.validator.addMethod( "creditcard", function( value, element ) {
if ( this.optional( element ) ) {
return "dependency-mismatch";
}
// Accept only spaces, digits and dashes
if ( /[^0-9 \-]+/.test( value ) ) {
return false;
}
var nCheck = 0,
nDigit = 0,
bEven = false,
n, cDigit;
value = value.replace( /\D/g, "" );
// Basing min and max length on
// https://developer.ean.com/general_info/Valid_Credit_Card_Types
if ( value.length < 13 || value.length > 19 ) {
return false;
}
for ( n = value.length - 1; n >= 0; n-- ) {
cDigit = value.charAt( n );
nDigit = parseInt( cDigit, 10 );
if ( bEven ) {
if ( ( nDigit *= 2 ) > 9 ) {
nDigit -= 9;
}
}
nCheck += nDigit;
bEven = !bEven;
}
return ( nCheck % 10 ) === 0;
}, "Please enter a valid credit card number." );
/* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator /* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
* Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 * Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
* Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) * Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
@ -286,31 +398,31 @@ $.validator.addMethod("creditcardtypes", function(value, element, param) {
if ( param.all ) { if ( param.all ) {
validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080; validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
} }
if (validTypes & 0x0001 && /^(5[12345])/.test(value)) { //mastercard if ( validTypes & 0x0001 && /^(5[12345])/.test( value ) ) { // Mastercard
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa if ( validTypes & 0x0002 && /^(4)/.test( value ) ) { // Visa
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0004 && /^(3[47])/.test(value)) { //amex if ( validTypes & 0x0004 && /^(3[47])/.test( value ) ) { // Amex
return value.length === 15; return value.length === 15;
} }
if (validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test(value)) { //dinersclub if ( validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test( value ) ) { // Dinersclub
return value.length === 14; return value.length === 14;
} }
if (validTypes & 0x0010 && /^(2(014|149))/.test(value)) { //enroute if ( validTypes & 0x0010 && /^(2(014|149))/.test( value ) ) { // Enroute
return value.length === 15; return value.length === 15;
} }
if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover if ( validTypes & 0x0020 && /^(6011)/.test( value ) ) { // Discover
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb if ( validTypes & 0x0040 && /^(3)/.test( value ) ) { // Jcb
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb if ( validTypes & 0x0040 && /^(2131|1800)/.test( value ) ) { // Jcb
return value.length === 15; return value.length === 15;
} }
if (validTypes & 0x0080) { //unknown if ( validTypes & 0x0080 ) { // Unknown
return true; return true;
} }
return false; return false;
@ -422,14 +534,17 @@ $.validator.addMethod("giroaccountNL", function(value, element) {
/** /**
* IBAN is the international bank account number. * IBAN is the international bank account number.
* It has a country - specific format, that is checked here too * It has a country - specific format, that is checked here too
*
* Validation is case-insensitive. Please make sure to normalize input yourself.
*/ */
$.validator.addMethod( "iban", function( value, element ) { $.validator.addMethod( "iban", function( value, element ) {
// some quick simple tests to prevent needless work
// Some quick simple tests to prevent needless work
if ( this.optional( element ) ) { if ( this.optional( element ) ) {
return true; return true;
} }
// remove spaces and to upper case // Remove spaces and to upper case
var iban = value.replace( / /g, "" ).toUpperCase(), var iban = value.replace( / /g, "" ).toUpperCase(),
ibancheckdigits = "", ibancheckdigits = "",
leadingZeroes = true, leadingZeroes = true,
@ -437,7 +552,17 @@ $.validator.addMethod("iban", function(value, element) {
cOperator = "", cOperator = "",
countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p; countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p;
// check the country code and find the country specific format // Check for IBAN code length.
// It contains:
// country code ISO 3166-1 - two letters,
// two check digits,
// Basic Bank Account Number (BBAN) - up to 30 chars
var minimalIBANlength = 5;
if ( iban.length < minimalIBANlength ) {
return false;
}
// Check the country code and find the country specific format
countrycode = iban.substring( 0, 2 ); countrycode = iban.substring( 0, 2 );
bbancountrypatterns = { bbancountrypatterns = {
"AL": "\\d{8}[\\dA-Z]{16}", "AL": "\\d{8}[\\dA-Z]{16}",
@ -507,6 +632,7 @@ $.validator.addMethod("iban", function(value, element) {
}; };
bbanpattern = bbancountrypatterns[ countrycode ]; bbanpattern = bbancountrypatterns[ countrycode ];
// As new countries will start using IBAN in the // As new countries will start using IBAN in the
// future, we only check if the countrycode is known. // future, we only check if the countrycode is known.
// This prevents false negatives, while almost all // This prevents false negatives, while almost all
@ -517,11 +643,11 @@ $.validator.addMethod("iban", function(value, element) {
if ( typeof bbanpattern !== "undefined" ) { if ( typeof bbanpattern !== "undefined" ) {
ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" ); ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" );
if ( !( ibanregexp.test( iban ) ) ) { if ( !( ibanregexp.test( iban ) ) ) {
return false; // invalid country specific format return false; // Invalid country specific format
} }
} }
// now check the checksum, first convert to digits // Now check the checksum, first convert to digits
ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 ); ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 );
for ( i = 0; i < ibancheck.length; i++ ) { for ( i = 0; i < ibancheck.length; i++ ) {
charAt = ibancheck.charAt( i ); charAt = ibancheck.charAt( i );
@ -533,7 +659,7 @@ $.validator.addMethod("iban", function(value, element) {
} }
} }
// calculate the result of: ibancheckdigits % 97 // Calculate the result of: ibancheckdigits % 97
for ( p = 0; p < ibancheckdigits.length; p++ ) { for ( p = 0; p < ibancheckdigits.length; p++ ) {
cChar = ibancheckdigits.charAt( p ); cChar = ibancheckdigits.charAt( p );
cOperator = "" + cRest + "" + cChar; cOperator = "" + cRest + "" + cChar;
@ -580,47 +706,60 @@ $.validator.addMethod("mobileUK", function(phone_number, element) {
phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ ); phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ );
}, "Please specify a valid mobile number" ); }, "Please specify a valid mobile number" );
$.validator.addMethod( "netmask", function( value, element ) {
return this.optional( element ) || /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test( value );
}, "Please enter a valid netmask." );
/* /*
* The número de identidad de extranjero ( NIE )is a code used to identify the non-nationals in Spain * The NIE (Número de Identificación de Extranjero) is a Spanish tax identification number assigned by the Spanish
* authorities to any foreigner.
*
* The NIE is the equivalent of a Spaniards Número de Identificación Fiscal (NIF) which serves as a fiscal
* identification number. The CIF number (Certificado de Identificación Fiscal) is equivalent to the NIF, but applies to
* companies rather than individuals. The NIE consists of an 'X' or 'Y' followed by 7 or 8 digits then another letter.
*/ */
$.validator.addMethod( "nieES", function( value ) { $.validator.addMethod( "nieES", function( value, element ) {
"use strict"; "use strict";
value = value.toUpperCase(); if ( this.optional( element ) ) {
return true;
}
// Basic format test var nieRegEx = new RegExp( /^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi );
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { var validChars = "TRWAGMYFPDXBNJZSQVHLCKET",
letter = value.substr( value.length - 1 ).toUpperCase(),
number;
value = value.toString().toUpperCase();
// Quick format test
if ( value.length > 10 || value.length < 9 || !nieRegEx.test( value ) ) {
return false; return false;
} }
// Test NIE // X means same number
//T // Y means number + 10000000
if ( /^[T]{1}/.test( value ) ) { // Z means number + 20000000
return ( value[ 8 ] === /^[T]{1}[A-Z0-9]{8}$/.test( value ) ); value = value.replace( /^[X]/, "0" )
} .replace( /^[Y]/, "1" )
.replace( /^[Z]/, "2" );
//XYZ number = value.length === 9 ? value.substr( 0, 8 ) : value.substr( 0, 9 );
if ( /^[XYZ]{1}/.test( value ) ) {
return (
value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt(
value.replace( "X", "0" )
.replace( "Y", "1" )
.replace( "Z", "2" )
.substring( 0, 8 ) % 23
)
);
}
return false; return validChars.charAt( parseInt( number, 10 ) % 23 ) === letter;
}, "Please specify a valid NIE number." ); }, "Please specify a valid NIE number." );
/* /*
* The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals * The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals
*/ */
$.validator.addMethod( "nifES", function( value ) { $.validator.addMethod( "nifES", function( value, element ) {
"use strict"; "use strict";
if ( this.optional( element ) ) {
return true;
}
value = value.toUpperCase(); value = value.toUpperCase();
// Basic format test // Basic format test
@ -632,16 +771,40 @@ $.validator.addMethod( "nifES", function( value ) {
if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) { if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) {
return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) ); return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) );
} }
// Test specials NIF (starts with K, L or M) // Test specials NIF (starts with K, L or M)
if ( /^[KLM]{1}/.test( value ) ) { if ( /^[KLM]{1}/.test( value ) ) {
return ( value[ 8 ] === String.fromCharCode( 64 ) ); return ( value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 1 ) % 23 ) );
} }
return false; return false;
}, "Please specify a valid NIF number." ); }, "Please specify a valid NIF number." );
jQuery.validator.addMethod( "notEqualTo", function( value, element, param ) { /*
* Numer identyfikacji podatkowej ( NIP ) is the way tax identification used in Poland for companies
*/
$.validator.addMethod( "nipPL", function( value ) {
"use strict";
value = value.replace( /[^0-9]/g, "" );
if ( value.length !== 10 ) {
return false;
}
var arrSteps = [ 6, 5, 7, 2, 3, 4, 5, 6, 7 ];
var intSum = 0;
for ( var i = 0; i < 9; i++ ) {
intSum += arrSteps[ i ] * value[ i ];
}
var int2 = intSum % 11;
var intControlNr = ( int2 === 10 ) ? 0 : int2;
return ( intControlNr === parseInt( value[ 9 ], 10 ) );
}, "Please specify a valid NIP number." );
$.validator.addMethod( "notEqualTo", function( value, element, param ) {
return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param ); return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param );
}, "Please enter a different value, values must not be the same." ); }, "Please enter a different value, values must not be the same." );
@ -679,6 +842,22 @@ $.validator.addMethod("phoneNL", function(value, element) {
return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value );
}, "Please specify a valid phone number." ); }, "Please specify a valid phone number." );
/* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
* A number of very detailed GB telephone number RegEx patterns can also be found at:
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
*/
// Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
$.validator.addMethod( "phonesUK", function( phone_number, element ) {
phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" );
return this.optional( element ) || phone_number.length > 9 &&
phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ );
}, "Please specify a valid uk phone number" );
/* For UK phone functions, do the following server side processing: /* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern: * Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
@ -694,7 +873,7 @@ $.validator.addMethod("phoneUK", function(phone_number, element) {
}, "Please specify a valid phone number" ); }, "Please specify a valid phone number" );
/** /**
* matches US phone number format * Matches US phone number format
* *
* where the area code may not start with 1 and the prefix may not start with 1 * where the area code may not start with 1 and the prefix may not start with 1
* allows '-' or ' ' as a separator and allows parens around area code * allows '-' or ' ' as a separator and allows parens around area code
@ -715,20 +894,17 @@ $.validator.addMethod("phoneUS", function(phone_number, element) {
phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ ); phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ );
}, "Please specify a valid phone number" ); }, "Please specify a valid phone number" );
/* For UK phone functions, do the following server side processing: /*
* Compare original input with this RegEx pattern: * Valida CEPs do brasileiros:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ *
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0' * Formatos aceitos:
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2. * 99999-999
* A number of very detailed GB telephone number RegEx patterns can also be found at: * 99.999-999
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers * 99999999
*/ */
//Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers $.validator.addMethod( "postalcodeBR", function( cep_value, element ) {
$.validator.addMethod("phonesUK", function(phone_number, element) { return this.optional( element ) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
phone_number = phone_number.replace(/\(|\)|\s+|-/g, ""); }, "Informe um CEP válido." );
return this.optional(element) || phone_number.length > 9 &&
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/);
}, "Please specify a valid uk phone number");
/** /**
* Matches a valid Canadian Postal Code * Matches a valid Canadian Postal Code
@ -744,21 +920,9 @@ $.validator.addMethod("phonesUK", function(phone_number, element) {
* @cat Plugins/Validate/Methods * @cat Plugins/Validate/Methods
*/ */
$.validator.addMethod( "postalCodeCA", function( value, element ) { $.validator.addMethod( "postalCodeCA", function( value, element ) {
return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d$/.test( value ); return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value );
}, "Please specify a valid postal code" ); }, "Please specify a valid postal code" );
/*
* Valida CEPs do brasileiros:
*
* Formatos aceitos:
* 99999-999
* 99.999-999
* 99999999
*/
$.validator.addMethod("postalcodeBR", function(cep_value, element) {
return this.optional(element) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
}, "Informe um CEP válido.");
/* Matches Italian postcode (CAP) */ /* Matches Italian postcode (CAP) */
$.validator.addMethod( "postalcodeIT", function( value, element ) { $.validator.addMethod( "postalcodeIT", function( value, element ) {
return this.optional( element ) || /^\d{5}$/.test( value ); return this.optional( element ) || /^\d{5}$/.test( value );
@ -888,10 +1052,7 @@ $.validator.addMethod("skip_or_fill_minimum", function(value, element, options)
* includeMilitary: true * includeMilitary: true
* } * }
* *
*
*
*/ */
$.validator.addMethod( "stateUS", function( value, element, options ) { $.validator.addMethod( "stateUS", function( value, element, options ) {
var isDefault = typeof options === "undefined", var isDefault = typeof options === "undefined",
caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive, caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive,
@ -911,8 +1072,7 @@ $.validator.addMethod("stateUS", function(value, element, options) {
regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" ); regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" );
return this.optional( element ) || regex.test( value ); return this.optional( element ) || regex.test( value );
}, }, "Please specify a valid state" );
"Please specify a valid state");
// TODO check if value starts with <, otherwise don't try stripping anything // TODO check if value starts with <, otherwise don't try stripping anything
$.validator.addMethod( "strippedminlength", function( value, element, param ) { $.validator.addMethod( "strippedminlength", function( value, element, param ) {
@ -927,7 +1087,7 @@ $.validator.addMethod("time12h", function(value, element) {
return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value ); return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value );
}, "Please enter a valid time in 12-hour am/pm format" ); }, "Please enter a valid time in 12-hour am/pm format" );
// same as url, but TLD is optional // Same as url, but TLD is optional
$.validator.addMethod( "url2", function( value, element ) { $.validator.addMethod( "url2", function( value, element ) {
return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value ); return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
}, $.validator.messages.url ); }, $.validator.messages.url );
@ -994,5 +1154,5 @@ $.validator.addMethod("zipcodeUS", function(value, element) {
$.validator.addMethod( "ziprange", function( value, element ) { $.validator.addMethod( "ziprange", function( value, element ) {
return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value ); return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value );
}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" ); }, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" );
return $;
})); }));

View File

@ -1,44 +1,15 @@
{ {
"name": "jquery-validation-unobtrusive", "name": "jquery-validation-unobtrusive",
"version": "3.2.6",
"homepage": "https://github.com/aspnet/jquery-validation-unobtrusive", "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
"description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.", "version": "3.2.9",
"main": [ "_release": "3.2.9",
"jquery.validate.unobtrusive.js"
],
"ignore": [
"**/.*",
"*.json",
"*.md",
"*.txt",
"gulpfile.js"
],
"keywords": [
"jquery",
"asp.net",
"mvc",
"validation",
"unobtrusive"
],
"authors": [
"Microsoft"
],
"license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
"repository": {
"type": "git",
"url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
},
"dependencies": {
"jquery-validation": ">=1.8",
"jquery": ">=1.8"
},
"_release": "3.2.6",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v3.2.6", "tag": "v3.2.9",
"commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7" "commit": "a91f5401898e125f10771c5f5f0909d8c4c82396"
}, },
"_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git", "_source": "https://github.com/aspnet/jquery-validation-unobtrusive.git",
"_target": "3.2.6", "_target": "^3.2.9",
"_originalSource": "jquery-validation-unobtrusive" "_originalSource": "jquery-validation-unobtrusive",
"_direct": true
} }

View File

@ -0,0 +1,12 @@
Copyright (c) .NET Foundation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
these files except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

View File

@ -1,12 +1,22 @@
/*! // Unobtrusive validation support library for jQuery and jQuery Validate
** Unobtrusive validation support library for jQuery and jQuery Validate // Copyright (C) Microsoft Corporation. All rights reserved.
** Copyright (C) Microsoft Corporation. All rights reserved. // @version v3.2.9
*/
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
/*global document: false, jQuery: false */ /*global document: false, jQuery: false */
(function ($) { (function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define("jquery.validate.unobtrusive", ['jquery.validation'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports
module.exports = factory(require('jquery-validation'));
} else {
// Browser global
jQuery.validator.unobtrusive = factory(jQuery);
}
}(function ($) {
var $jQval = $.validator, var $jQval = $.validator,
adapters, adapters,
data_validation = "unobtrusiveValidation"; data_validation = "unobtrusiveValidation";
@ -118,7 +128,7 @@
execInContext = function (name, args) { execInContext = function (name, args) {
var func = defaultOptions[name]; var func = defaultOptions[name];
func && $.isFunction(func) && func.apply(form, args); func && $.isFunction(func) && func.apply(form, args);
} };
if (!result) { if (!result) {
result = { result = {
@ -409,8 +419,13 @@
setValidationValues(options, "regex", options.params.regex); setValidationValues(options, "regex", options.params.regex);
} }
}); });
adapters.add("fileextensions", ["extensions"], function (options) {
setValidationValues(options, "extension", options.params.extensions);
});
$(function () { $(function () {
$jQval.unobtrusive.parse(document); $jQval.unobtrusive.parse(document);
}); });
}(jQuery));
return $jQval.unobtrusive;
}));

View File

@ -1,9 +1,9 @@
{ {
"name": "jquery-validation", "name": "jquery-validation",
"homepage": "http://jqueryvalidation.org/", "homepage": "https://jqueryvalidation.org/",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/jzaefferer/jquery-validation.git" "url": "git://github.com/jquery-validation/jquery-validation.git"
}, },
"authors": [ "authors": [
"Jörn Zaefferer <joern.zaefferer@gmail.com>" "Jörn Zaefferer <joern.zaefferer@gmail.com>"
@ -27,14 +27,15 @@
"dependencies": { "dependencies": {
"jquery": ">= 1.7.2" "jquery": ">= 1.7.2"
}, },
"version": "1.14.0", "version": "1.17.0",
"_release": "1.14.0", "_release": "1.17.0",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.14.0", "tag": "1.17.0",
"commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48" "commit": "fc9b12d3bfaa2d0c04605855b896edb2934c0772"
}, },
"_source": "git://github.com/jzaefferer/jquery-validation.git", "_source": "https://github.com/jzaefferer/jquery-validation.git",
"_target": ">=1.8", "_target": "^1.17.0",
"_originalSource": "jquery-validation" "_originalSource": "jquery-validation",
"_direct": true
} }

View File

@ -1,14 +1,16 @@
/*! /*!
* jQuery Validation Plugin v1.14.0 * jQuery Validation Plugin v1.17.0
* *
* http://jqueryvalidation.org/ * https://jqueryvalidation.org/
* *
* Copyright (c) 2015 Jörn Zaefferer * Copyright (c) 2017 Jörn Zaefferer
* Released under the MIT license * Released under the MIT license
*/ */
(function( factory ) { (function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
define( ["jquery", "./jquery.validate"], factory ); define( ["jquery", "./jquery.validate"], factory );
} else if (typeof module === "object" && module.exports) {
module.exports = factory( require( "jquery" ) );
} else { } else {
factory( jQuery ); factory( jQuery );
} }
@ -17,9 +19,11 @@
( function() { ( function() {
function stripHtml( value ) { function stripHtml( value ) {
// remove html tags and space chars
// Remove html tags and space chars
return value.replace( /<.[^<>]*?>/g, " " ).replace( /&nbsp;|&#160;/gi, " " ) return value.replace( /<.[^<>]*?>/g, " " ).replace( /&nbsp;|&#160;/gi, " " )
// remove punctuation
// Remove punctuation
.replace( /[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "" ); .replace( /[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "" );
} }
@ -41,10 +45,11 @@
// Accept a value from a file input based on a required mimetype // Accept a value from a file input based on a required mimetype
$.validator.addMethod( "accept", function( value, element, param ) { $.validator.addMethod( "accept", function( value, element, param ) {
// Split mime on commas in case we have multiple types we can accept // Split mime on commas in case we have multiple types we can accept
var typeParam = typeof param === "string" ? param.replace(/\s/g, "").replace(/,/g, "|") : "image/*", var typeParam = typeof param === "string" ? param.replace( /\s/g, "" ) : "image/*",
optionalValue = this.optional( element ), optionalValue = this.optional( element ),
i, file; i, file, regex;
// Element is optional // Element is optional
if ( optionalValue ) { if ( optionalValue ) {
@ -52,16 +57,23 @@ $.validator.addMethod("accept", function(value, element, param) {
} }
if ( $( element ).attr( "type" ) === "file" ) { if ( $( element ).attr( "type" ) === "file" ) {
// If we are using a wildcard, make it regex friendly
typeParam = typeParam.replace(/\*/g, ".*"); // Escape string to be used in the regex
// see: https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
// Escape also "/*" as "/.*" as a wildcard
typeParam = typeParam
.replace( /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, "\\$&" )
.replace( /,/g, "|" )
.replace( /\/\*/g, "/.*" );
// Check if the element has a FileList before checking each file // Check if the element has a FileList before checking each file
if ( element.files && element.files.length ) { if ( element.files && element.files.length ) {
regex = new RegExp( ".?(" + typeParam + ")$", "i" );
for ( i = 0; i < element.files.length; i++ ) { for ( i = 0; i < element.files.length; i++ ) {
file = element.files[ i ]; file = element.files[ i ];
// Grab the mimetype from the loaded file, verify it matches // Grab the mimetype from the loaded file, verify it matches
if (!file.type.match(new RegExp( "\\.?(" + typeParam + ")$", "i"))) { if ( !file.type.match( regex ) ) {
return false; return false;
} }
} }
@ -90,8 +102,9 @@ $.validator.addMethod("bankaccountNL", function(value, element) {
if ( !( /^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test( value ) ) ) { if ( !( /^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test( value ) ) ) {
return false; return false;
} }
// now '11 check'
var account = value.replace(/ /g, ""), // remove spaces // Now '11 check'
var account = value.replace( / /g, "" ), // Remove spaces
sum = 0, sum = 0,
len = account.length, len = account.length,
pos, factor, digit; pos, factor, digit;
@ -114,49 +127,37 @@ $.validator.addMethod("bankorgiroaccountNL", function(value, element) {
* *
* BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional) * BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional)
* *
* Validation is case-insensitive. Please make sure to normalize input yourself.
*
* BIC definition in detail: * BIC definition in detail:
* - First 4 characters - bank code (only letters) * - First 4 characters - bank code (only letters)
* - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters) * - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters)
* - Next 2 characters - location code (letters and digits) * - Next 2 characters - location code (letters and digits)
* a. shall not start with '0' or '1' * a. shall not start with '0' or '1'
* b. second character must be a letter ('O' is not allowed) or one of the following digits ('0' for test (therefore not allowed), '1' for passive participant and '2' for active participant) * b. second character must be a letter ('O' is not allowed) or digit ('0' for test (therefore not allowed), '1' denoting passive participant, '2' typically reverse-billing)
* - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits) * - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits)
*/ */
$.validator.addMethod( "bic", function( value, element ) { $.validator.addMethod( "bic", function( value, element ) {
return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-2])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value ); return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() );
}, "Please specify a valid BIC code" ); }, "Please specify a valid BIC code" );
/* /*
* Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities * Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities
* Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal * Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal
*/ *
$.validator.addMethod( "cifES", function( value ) { * Spanish CIF structure:
"use strict"; *
* [ T ][ P ][ P ][ N ][ N ][ N ][ N ][ N ][ C ]
var num = [], *
controlDigit, sum, i, count, tmp, secondDigit; * Where:
*
value = value.toUpperCase(); * T: 1 character. Kind of Organization Letter: [ABCDEFGHJKLMNPQRSUVW]
* P: 2 characters. Province.
// Quick format test * N: 5 characters. Secuencial Number within the province.
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { * C: 1 character. Control Digit: [0-9A-J].
return false; *
} * [ T ]: Kind of Organizations. Possible values:
*
for ( i = 0; i < 9; i++ ) {
num[ i ] = parseInt( value.charAt( i ), 10 );
}
// Algorithm for checking CIF codes
sum = num[ 2 ] + num[ 4 ] + num[ 6 ];
for ( count = 1; count < 8; count += 2 ) {
tmp = ( 2 * num[ count ] ).toString();
secondDigit = tmp.charAt( 1 );
sum += parseInt( tmp.charAt( 0 ), 10 ) + ( secondDigit === "" ? 0 : parseInt( secondDigit, 10 ) );
}
/* The first (position 1) is a letter following the following criteria:
* A. Corporations * A. Corporations
* B. LLCs * B. LLCs
* C. General partnerships * C. General partnerships
@ -176,15 +177,82 @@ $.validator.addMethod( "cifES", function( value ) {
* S. Organs of State Administration and regions * S. Organs of State Administration and regions
* V. Agrarian Transformation * V. Agrarian Transformation
* W. Permanent establishments of non-resident in Spain * W. Permanent establishments of non-resident in Spain
*
* [ C ]: Control Digit. It can be a number or a letter depending on T value:
* [ T ] --> [ C ]
* ------ ----------
* A Number
* B Number
* E Number
* H Number
* K Letter
* P Letter
* Q Letter
* S Letter
*
*/ */
if ( /^[ABCDEFGHJNPQRSUVW]{1}/.test( value ) ) { $.validator.addMethod( "cifES", function( value, element ) {
sum += ""; "use strict";
controlDigit = 10 - parseInt( sum.charAt( sum.length - 1 ), 10 );
value += controlDigit; if ( this.optional( element ) ) {
return ( num[ 8 ].toString() === String.fromCharCode( 64 + controlDigit ) || num[ 8 ].toString() === value.charAt( value.length - 1 ) ); return true;
} }
var cifRegEx = new RegExp( /^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi );
var letter = value.substring( 0, 1 ), // [ T ]
number = value.substring( 1, 8 ), // [ P ][ P ][ N ][ N ][ N ][ N ][ N ]
control = value.substring( 8, 9 ), // [ C ]
all_sum = 0,
even_sum = 0,
odd_sum = 0,
i, n,
control_digit,
control_letter;
function isOdd( n ) {
return n % 2 === 0;
}
// Quick format test
if ( value.length !== 9 || !cifRegEx.test( value ) ) {
return false; return false;
}
for ( i = 0; i < number.length; i++ ) {
n = parseInt( number[ i ], 10 );
// Odd positions
if ( isOdd( i ) ) {
// Odd positions are multiplied first.
n *= 2;
// If the multiplication is bigger than 10 we need to adjust
odd_sum += n < 10 ? n : n - 9;
// Even positions
// Just sum them
} else {
even_sum += n;
}
}
all_sum = even_sum + odd_sum;
control_digit = ( 10 - ( all_sum ).toString().substr( -1 ) ).toString();
control_digit = parseInt( control_digit, 10 ) > 9 ? "0" : control_digit;
control_letter = "JABCDEFGHI".substr( control_digit, 1 ).toString();
// Control must be a digit
if ( letter.match( /[ABEH]/ ) ) {
return control === control_digit;
// Control must be a letter
} else if ( letter.match( /[KPQS]/ ) ) {
return control === control_letter;
}
// Can be either
return control === control_digit || control === control_letter;
}, "Please specify a valid CIF number." ); }, "Please specify a valid CIF number." );
@ -193,6 +261,7 @@ $.validator.addMethod( "cifES", function( value ) {
* CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. * CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation.
*/ */
$.validator.addMethod( "cpfBR", function( value ) { $.validator.addMethod( "cpfBR", function( value ) {
// Removing special characters from value // Removing special characters from value
value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" );
@ -209,7 +278,9 @@ $.validator.addMethod("cpfBR", function(value) {
checkResult = function( sum, cn ) { checkResult = function( sum, cn ) {
var result = ( sum * 10 ) % 11; var result = ( sum * 10 ) % 11;
if ((result === 10) || (result === 11)) {result = 0;} if ( ( result === 10 ) || ( result === 11 ) ) {
result = 0;
}
return ( result === cn ); return ( result === cn );
}; };
@ -246,6 +317,47 @@ $.validator.addMethod("cpfBR", function(value) {
}, "Please specify a valid CPF number" ); }, "Please specify a valid CPF number" );
// https://jqueryvalidation.org/creditcard-method/
// based on https://en.wikipedia.org/wiki/Luhn_algorithm
$.validator.addMethod( "creditcard", function( value, element ) {
if ( this.optional( element ) ) {
return "dependency-mismatch";
}
// Accept only spaces, digits and dashes
if ( /[^0-9 \-]+/.test( value ) ) {
return false;
}
var nCheck = 0,
nDigit = 0,
bEven = false,
n, cDigit;
value = value.replace( /\D/g, "" );
// Basing min and max length on
// https://developer.ean.com/general_info/Valid_Credit_Card_Types
if ( value.length < 13 || value.length > 19 ) {
return false;
}
for ( n = value.length - 1; n >= 0; n-- ) {
cDigit = value.charAt( n );
nDigit = parseInt( cDigit, 10 );
if ( bEven ) {
if ( ( nDigit *= 2 ) > 9 ) {
nDigit -= 9;
}
}
nCheck += nDigit;
bEven = !bEven;
}
return ( nCheck % 10 ) === 0;
}, "Please enter a valid credit card number." );
/* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator /* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
* Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 * Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
* Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) * Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
@ -286,31 +398,31 @@ $.validator.addMethod("creditcardtypes", function(value, element, param) {
if ( param.all ) { if ( param.all ) {
validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080; validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
} }
if (validTypes & 0x0001 && /^(5[12345])/.test(value)) { //mastercard if ( validTypes & 0x0001 && /^(5[12345])/.test( value ) ) { // Mastercard
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa if ( validTypes & 0x0002 && /^(4)/.test( value ) ) { // Visa
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0004 && /^(3[47])/.test(value)) { //amex if ( validTypes & 0x0004 && /^(3[47])/.test( value ) ) { // Amex
return value.length === 15; return value.length === 15;
} }
if (validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test(value)) { //dinersclub if ( validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test( value ) ) { // Dinersclub
return value.length === 14; return value.length === 14;
} }
if (validTypes & 0x0010 && /^(2(014|149))/.test(value)) { //enroute if ( validTypes & 0x0010 && /^(2(014|149))/.test( value ) ) { // Enroute
return value.length === 15; return value.length === 15;
} }
if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover if ( validTypes & 0x0020 && /^(6011)/.test( value ) ) { // Discover
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb if ( validTypes & 0x0040 && /^(3)/.test( value ) ) { // Jcb
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb if ( validTypes & 0x0040 && /^(2131|1800)/.test( value ) ) { // Jcb
return value.length === 15; return value.length === 15;
} }
if (validTypes & 0x0080) { //unknown if ( validTypes & 0x0080 ) { // Unknown
return true; return true;
} }
return false; return false;
@ -422,14 +534,17 @@ $.validator.addMethod("giroaccountNL", function(value, element) {
/** /**
* IBAN is the international bank account number. * IBAN is the international bank account number.
* It has a country - specific format, that is checked here too * It has a country - specific format, that is checked here too
*
* Validation is case-insensitive. Please make sure to normalize input yourself.
*/ */
$.validator.addMethod( "iban", function( value, element ) { $.validator.addMethod( "iban", function( value, element ) {
// some quick simple tests to prevent needless work
// Some quick simple tests to prevent needless work
if ( this.optional( element ) ) { if ( this.optional( element ) ) {
return true; return true;
} }
// remove spaces and to upper case // Remove spaces and to upper case
var iban = value.replace( / /g, "" ).toUpperCase(), var iban = value.replace( / /g, "" ).toUpperCase(),
ibancheckdigits = "", ibancheckdigits = "",
leadingZeroes = true, leadingZeroes = true,
@ -437,7 +552,17 @@ $.validator.addMethod("iban", function(value, element) {
cOperator = "", cOperator = "",
countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p; countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p;
// check the country code and find the country specific format // Check for IBAN code length.
// It contains:
// country code ISO 3166-1 - two letters,
// two check digits,
// Basic Bank Account Number (BBAN) - up to 30 chars
var minimalIBANlength = 5;
if ( iban.length < minimalIBANlength ) {
return false;
}
// Check the country code and find the country specific format
countrycode = iban.substring( 0, 2 ); countrycode = iban.substring( 0, 2 );
bbancountrypatterns = { bbancountrypatterns = {
"AL": "\\d{8}[\\dA-Z]{16}", "AL": "\\d{8}[\\dA-Z]{16}",
@ -507,6 +632,7 @@ $.validator.addMethod("iban", function(value, element) {
}; };
bbanpattern = bbancountrypatterns[ countrycode ]; bbanpattern = bbancountrypatterns[ countrycode ];
// As new countries will start using IBAN in the // As new countries will start using IBAN in the
// future, we only check if the countrycode is known. // future, we only check if the countrycode is known.
// This prevents false negatives, while almost all // This prevents false negatives, while almost all
@ -517,11 +643,11 @@ $.validator.addMethod("iban", function(value, element) {
if ( typeof bbanpattern !== "undefined" ) { if ( typeof bbanpattern !== "undefined" ) {
ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" ); ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" );
if ( !( ibanregexp.test( iban ) ) ) { if ( !( ibanregexp.test( iban ) ) ) {
return false; // invalid country specific format return false; // Invalid country specific format
} }
} }
// now check the checksum, first convert to digits // Now check the checksum, first convert to digits
ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 ); ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 );
for ( i = 0; i < ibancheck.length; i++ ) { for ( i = 0; i < ibancheck.length; i++ ) {
charAt = ibancheck.charAt( i ); charAt = ibancheck.charAt( i );
@ -533,7 +659,7 @@ $.validator.addMethod("iban", function(value, element) {
} }
} }
// calculate the result of: ibancheckdigits % 97 // Calculate the result of: ibancheckdigits % 97
for ( p = 0; p < ibancheckdigits.length; p++ ) { for ( p = 0; p < ibancheckdigits.length; p++ ) {
cChar = ibancheckdigits.charAt( p ); cChar = ibancheckdigits.charAt( p );
cOperator = "" + cRest + "" + cChar; cOperator = "" + cRest + "" + cChar;
@ -580,47 +706,60 @@ $.validator.addMethod("mobileUK", function(phone_number, element) {
phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ ); phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ );
}, "Please specify a valid mobile number" ); }, "Please specify a valid mobile number" );
$.validator.addMethod( "netmask", function( value, element ) {
return this.optional( element ) || /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test( value );
}, "Please enter a valid netmask." );
/* /*
* The número de identidad de extranjero ( NIE )is a code used to identify the non-nationals in Spain * The NIE (Número de Identificación de Extranjero) is a Spanish tax identification number assigned by the Spanish
* authorities to any foreigner.
*
* The NIE is the equivalent of a Spaniards Número de Identificación Fiscal (NIF) which serves as a fiscal
* identification number. The CIF number (Certificado de Identificación Fiscal) is equivalent to the NIF, but applies to
* companies rather than individuals. The NIE consists of an 'X' or 'Y' followed by 7 or 8 digits then another letter.
*/ */
$.validator.addMethod( "nieES", function( value ) { $.validator.addMethod( "nieES", function( value, element ) {
"use strict"; "use strict";
value = value.toUpperCase(); if ( this.optional( element ) ) {
return true;
}
// Basic format test var nieRegEx = new RegExp( /^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi );
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { var validChars = "TRWAGMYFPDXBNJZSQVHLCKET",
letter = value.substr( value.length - 1 ).toUpperCase(),
number;
value = value.toString().toUpperCase();
// Quick format test
if ( value.length > 10 || value.length < 9 || !nieRegEx.test( value ) ) {
return false; return false;
} }
// Test NIE // X means same number
//T // Y means number + 10000000
if ( /^[T]{1}/.test( value ) ) { // Z means number + 20000000
return ( value[ 8 ] === /^[T]{1}[A-Z0-9]{8}$/.test( value ) ); value = value.replace( /^[X]/, "0" )
} .replace( /^[Y]/, "1" )
.replace( /^[Z]/, "2" );
//XYZ number = value.length === 9 ? value.substr( 0, 8 ) : value.substr( 0, 9 );
if ( /^[XYZ]{1}/.test( value ) ) {
return (
value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt(
value.replace( "X", "0" )
.replace( "Y", "1" )
.replace( "Z", "2" )
.substring( 0, 8 ) % 23
)
);
}
return false; return validChars.charAt( parseInt( number, 10 ) % 23 ) === letter;
}, "Please specify a valid NIE number." ); }, "Please specify a valid NIE number." );
/* /*
* The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals * The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals
*/ */
$.validator.addMethod( "nifES", function( value ) { $.validator.addMethod( "nifES", function( value, element ) {
"use strict"; "use strict";
if ( this.optional( element ) ) {
return true;
}
value = value.toUpperCase(); value = value.toUpperCase();
// Basic format test // Basic format test
@ -632,16 +771,40 @@ $.validator.addMethod( "nifES", function( value ) {
if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) { if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) {
return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) ); return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) );
} }
// Test specials NIF (starts with K, L or M) // Test specials NIF (starts with K, L or M)
if ( /^[KLM]{1}/.test( value ) ) { if ( /^[KLM]{1}/.test( value ) ) {
return ( value[ 8 ] === String.fromCharCode( 64 ) ); return ( value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 1 ) % 23 ) );
} }
return false; return false;
}, "Please specify a valid NIF number." ); }, "Please specify a valid NIF number." );
jQuery.validator.addMethod( "notEqualTo", function( value, element, param ) { /*
* Numer identyfikacji podatkowej ( NIP ) is the way tax identification used in Poland for companies
*/
$.validator.addMethod( "nipPL", function( value ) {
"use strict";
value = value.replace( /[^0-9]/g, "" );
if ( value.length !== 10 ) {
return false;
}
var arrSteps = [ 6, 5, 7, 2, 3, 4, 5, 6, 7 ];
var intSum = 0;
for ( var i = 0; i < 9; i++ ) {
intSum += arrSteps[ i ] * value[ i ];
}
var int2 = intSum % 11;
var intControlNr = ( int2 === 10 ) ? 0 : int2;
return ( intControlNr === parseInt( value[ 9 ], 10 ) );
}, "Please specify a valid NIP number." );
$.validator.addMethod( "notEqualTo", function( value, element, param ) {
return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param ); return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param );
}, "Please enter a different value, values must not be the same." ); }, "Please enter a different value, values must not be the same." );
@ -679,6 +842,22 @@ $.validator.addMethod("phoneNL", function(value, element) {
return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value );
}, "Please specify a valid phone number." ); }, "Please specify a valid phone number." );
/* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
* A number of very detailed GB telephone number RegEx patterns can also be found at:
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
*/
// Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
$.validator.addMethod( "phonesUK", function( phone_number, element ) {
phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" );
return this.optional( element ) || phone_number.length > 9 &&
phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ );
}, "Please specify a valid uk phone number" );
/* For UK phone functions, do the following server side processing: /* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern: * Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
@ -694,7 +873,7 @@ $.validator.addMethod("phoneUK", function(phone_number, element) {
}, "Please specify a valid phone number" ); }, "Please specify a valid phone number" );
/** /**
* matches US phone number format * Matches US phone number format
* *
* where the area code may not start with 1 and the prefix may not start with 1 * where the area code may not start with 1 and the prefix may not start with 1
* allows '-' or ' ' as a separator and allows parens around area code * allows '-' or ' ' as a separator and allows parens around area code
@ -715,20 +894,17 @@ $.validator.addMethod("phoneUS", function(phone_number, element) {
phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ ); phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ );
}, "Please specify a valid phone number" ); }, "Please specify a valid phone number" );
/* For UK phone functions, do the following server side processing: /*
* Compare original input with this RegEx pattern: * Valida CEPs do brasileiros:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ *
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0' * Formatos aceitos:
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2. * 99999-999
* A number of very detailed GB telephone number RegEx patterns can also be found at: * 99.999-999
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers * 99999999
*/ */
//Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers $.validator.addMethod( "postalcodeBR", function( cep_value, element ) {
$.validator.addMethod("phonesUK", function(phone_number, element) { return this.optional( element ) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
phone_number = phone_number.replace(/\(|\)|\s+|-/g, ""); }, "Informe um CEP válido." );
return this.optional(element) || phone_number.length > 9 &&
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/);
}, "Please specify a valid uk phone number");
/** /**
* Matches a valid Canadian Postal Code * Matches a valid Canadian Postal Code
@ -744,21 +920,9 @@ $.validator.addMethod("phonesUK", function(phone_number, element) {
* @cat Plugins/Validate/Methods * @cat Plugins/Validate/Methods
*/ */
$.validator.addMethod( "postalCodeCA", function( value, element ) { $.validator.addMethod( "postalCodeCA", function( value, element ) {
return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d$/.test( value ); return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value );
}, "Please specify a valid postal code" ); }, "Please specify a valid postal code" );
/*
* Valida CEPs do brasileiros:
*
* Formatos aceitos:
* 99999-999
* 99.999-999
* 99999999
*/
$.validator.addMethod("postalcodeBR", function(cep_value, element) {
return this.optional(element) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
}, "Informe um CEP válido.");
/* Matches Italian postcode (CAP) */ /* Matches Italian postcode (CAP) */
$.validator.addMethod( "postalcodeIT", function( value, element ) { $.validator.addMethod( "postalcodeIT", function( value, element ) {
return this.optional( element ) || /^\d{5}$/.test( value ); return this.optional( element ) || /^\d{5}$/.test( value );
@ -888,10 +1052,7 @@ $.validator.addMethod("skip_or_fill_minimum", function(value, element, options)
* includeMilitary: true * includeMilitary: true
* } * }
* *
*
*
*/ */
$.validator.addMethod( "stateUS", function( value, element, options ) { $.validator.addMethod( "stateUS", function( value, element, options ) {
var isDefault = typeof options === "undefined", var isDefault = typeof options === "undefined",
caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive, caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive,
@ -911,8 +1072,7 @@ $.validator.addMethod("stateUS", function(value, element, options) {
regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" ); regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" );
return this.optional( element ) || regex.test( value ); return this.optional( element ) || regex.test( value );
}, }, "Please specify a valid state" );
"Please specify a valid state");
// TODO check if value starts with <, otherwise don't try stripping anything // TODO check if value starts with <, otherwise don't try stripping anything
$.validator.addMethod( "strippedminlength", function( value, element, param ) { $.validator.addMethod( "strippedminlength", function( value, element, param ) {
@ -927,7 +1087,7 @@ $.validator.addMethod("time12h", function(value, element) {
return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value ); return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value );
}, "Please enter a valid time in 12-hour am/pm format" ); }, "Please enter a valid time in 12-hour am/pm format" );
// same as url, but TLD is optional // Same as url, but TLD is optional
$.validator.addMethod( "url2", function( value, element ) { $.validator.addMethod( "url2", function( value, element ) {
return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value ); return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
}, $.validator.messages.url ); }, $.validator.messages.url );
@ -994,5 +1154,5 @@ $.validator.addMethod("zipcodeUS", function(value, element) {
$.validator.addMethod( "ziprange", function( value, element ) { $.validator.addMethod( "ziprange", function( value, element ) {
return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value ); return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value );
}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" ); }, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" );
return $;
})); }));

View File

@ -1,44 +1,15 @@
{ {
"name": "jquery-validation-unobtrusive", "name": "jquery-validation-unobtrusive",
"version": "3.2.6",
"homepage": "https://github.com/aspnet/jquery-validation-unobtrusive", "homepage": "https://github.com/aspnet/jquery-validation-unobtrusive",
"description": "Add-on to jQuery Validation to enable unobtrusive validation options in data-* attributes.", "version": "3.2.9",
"main": [ "_release": "3.2.9",
"jquery.validate.unobtrusive.js"
],
"ignore": [
"**/.*",
"*.json",
"*.md",
"*.txt",
"gulpfile.js"
],
"keywords": [
"jquery",
"asp.net",
"mvc",
"validation",
"unobtrusive"
],
"authors": [
"Microsoft"
],
"license": "http://www.microsoft.com/web/webpi/eula/net_library_eula_enu.htm",
"repository": {
"type": "git",
"url": "git://github.com/aspnet/jquery-validation-unobtrusive.git"
},
"dependencies": {
"jquery-validation": ">=1.8",
"jquery": ">=1.8"
},
"_release": "3.2.6",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v3.2.6", "tag": "v3.2.9",
"commit": "13386cd1b5947d8a5d23a12b531ce3960be1eba7" "commit": "a91f5401898e125f10771c5f5f0909d8c4c82396"
}, },
"_source": "git://github.com/aspnet/jquery-validation-unobtrusive.git", "_source": "https://github.com/aspnet/jquery-validation-unobtrusive.git",
"_target": "3.2.6", "_target": "^3.2.9",
"_originalSource": "jquery-validation-unobtrusive" "_originalSource": "jquery-validation-unobtrusive",
"_direct": true
} }

View File

@ -0,0 +1,12 @@
Copyright (c) .NET Foundation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
these files except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

View File

@ -1,12 +1,22 @@
/*! // Unobtrusive validation support library for jQuery and jQuery Validate
** Unobtrusive validation support library for jQuery and jQuery Validate // Copyright (C) Microsoft Corporation. All rights reserved.
** Copyright (C) Microsoft Corporation. All rights reserved. // @version v3.2.9
*/
/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ /*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */
/*global document: false, jQuery: false */ /*global document: false, jQuery: false */
(function ($) { (function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define("jquery.validate.unobtrusive", ['jquery.validation'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports
module.exports = factory(require('jquery-validation'));
} else {
// Browser global
jQuery.validator.unobtrusive = factory(jQuery);
}
}(function ($) {
var $jQval = $.validator, var $jQval = $.validator,
adapters, adapters,
data_validation = "unobtrusiveValidation"; data_validation = "unobtrusiveValidation";
@ -118,7 +128,7 @@
execInContext = function (name, args) { execInContext = function (name, args) {
var func = defaultOptions[name]; var func = defaultOptions[name];
func && $.isFunction(func) && func.apply(form, args); func && $.isFunction(func) && func.apply(form, args);
} };
if (!result) { if (!result) {
result = { result = {
@ -409,8 +419,13 @@
setValidationValues(options, "regex", options.params.regex); setValidationValues(options, "regex", options.params.regex);
} }
}); });
adapters.add("fileextensions", ["extensions"], function (options) {
setValidationValues(options, "extension", options.params.extensions);
});
$(function () { $(function () {
$jQval.unobtrusive.parse(document); $jQval.unobtrusive.parse(document);
}); });
}(jQuery));
return $jQval.unobtrusive;
}));

View File

@ -1,9 +1,9 @@
{ {
"name": "jquery-validation", "name": "jquery-validation",
"homepage": "http://jqueryvalidation.org/", "homepage": "https://jqueryvalidation.org/",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/jzaefferer/jquery-validation.git" "url": "git://github.com/jquery-validation/jquery-validation.git"
}, },
"authors": [ "authors": [
"Jörn Zaefferer <joern.zaefferer@gmail.com>" "Jörn Zaefferer <joern.zaefferer@gmail.com>"
@ -27,14 +27,15 @@
"dependencies": { "dependencies": {
"jquery": ">= 1.7.2" "jquery": ">= 1.7.2"
}, },
"version": "1.14.0", "version": "1.17.0",
"_release": "1.14.0", "_release": "1.17.0",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "1.14.0", "tag": "1.17.0",
"commit": "c1343fb9823392aa9acbe1c3ffd337b8c92fed48" "commit": "fc9b12d3bfaa2d0c04605855b896edb2934c0772"
}, },
"_source": "git://github.com/jzaefferer/jquery-validation.git", "_source": "https://github.com/jzaefferer/jquery-validation.git",
"_target": ">=1.8", "_target": "^1.17.0",
"_originalSource": "jquery-validation" "_originalSource": "jquery-validation",
"_direct": true
} }

View File

@ -1,14 +1,16 @@
/*! /*!
* jQuery Validation Plugin v1.14.0 * jQuery Validation Plugin v1.17.0
* *
* http://jqueryvalidation.org/ * https://jqueryvalidation.org/
* *
* Copyright (c) 2015 Jörn Zaefferer * Copyright (c) 2017 Jörn Zaefferer
* Released under the MIT license * Released under the MIT license
*/ */
(function( factory ) { (function( factory ) {
if ( typeof define === "function" && define.amd ) { if ( typeof define === "function" && define.amd ) {
define( ["jquery", "./jquery.validate"], factory ); define( ["jquery", "./jquery.validate"], factory );
} else if (typeof module === "object" && module.exports) {
module.exports = factory( require( "jquery" ) );
} else { } else {
factory( jQuery ); factory( jQuery );
} }
@ -17,9 +19,11 @@
( function() { ( function() {
function stripHtml( value ) { function stripHtml( value ) {
// remove html tags and space chars
// Remove html tags and space chars
return value.replace( /<.[^<>]*?>/g, " " ).replace( /&nbsp;|&#160;/gi, " " ) return value.replace( /<.[^<>]*?>/g, " " ).replace( /&nbsp;|&#160;/gi, " " )
// remove punctuation
// Remove punctuation
.replace( /[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "" ); .replace( /[.(),;:!?%#$'\"_+=\/\-“”’]*/g, "" );
} }
@ -41,10 +45,11 @@
// Accept a value from a file input based on a required mimetype // Accept a value from a file input based on a required mimetype
$.validator.addMethod( "accept", function( value, element, param ) { $.validator.addMethod( "accept", function( value, element, param ) {
// Split mime on commas in case we have multiple types we can accept // Split mime on commas in case we have multiple types we can accept
var typeParam = typeof param === "string" ? param.replace(/\s/g, "").replace(/,/g, "|") : "image/*", var typeParam = typeof param === "string" ? param.replace( /\s/g, "" ) : "image/*",
optionalValue = this.optional( element ), optionalValue = this.optional( element ),
i, file; i, file, regex;
// Element is optional // Element is optional
if ( optionalValue ) { if ( optionalValue ) {
@ -52,16 +57,23 @@ $.validator.addMethod("accept", function(value, element, param) {
} }
if ( $( element ).attr( "type" ) === "file" ) { if ( $( element ).attr( "type" ) === "file" ) {
// If we are using a wildcard, make it regex friendly
typeParam = typeParam.replace(/\*/g, ".*"); // Escape string to be used in the regex
// see: https://stackoverflow.com/questions/3446170/escape-string-for-use-in-javascript-regex
// Escape also "/*" as "/.*" as a wildcard
typeParam = typeParam
.replace( /[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g, "\\$&" )
.replace( /,/g, "|" )
.replace( /\/\*/g, "/.*" );
// Check if the element has a FileList before checking each file // Check if the element has a FileList before checking each file
if ( element.files && element.files.length ) { if ( element.files && element.files.length ) {
regex = new RegExp( ".?(" + typeParam + ")$", "i" );
for ( i = 0; i < element.files.length; i++ ) { for ( i = 0; i < element.files.length; i++ ) {
file = element.files[ i ]; file = element.files[ i ];
// Grab the mimetype from the loaded file, verify it matches // Grab the mimetype from the loaded file, verify it matches
if (!file.type.match(new RegExp( "\\.?(" + typeParam + ")$", "i"))) { if ( !file.type.match( regex ) ) {
return false; return false;
} }
} }
@ -90,8 +102,9 @@ $.validator.addMethod("bankaccountNL", function(value, element) {
if ( !( /^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test( value ) ) ) { if ( !( /^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test( value ) ) ) {
return false; return false;
} }
// now '11 check'
var account = value.replace(/ /g, ""), // remove spaces // Now '11 check'
var account = value.replace( / /g, "" ), // Remove spaces
sum = 0, sum = 0,
len = account.length, len = account.length,
pos, factor, digit; pos, factor, digit;
@ -114,49 +127,37 @@ $.validator.addMethod("bankorgiroaccountNL", function(value, element) {
* *
* BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional) * BIC pattern: BBBBCCLLbbb (8 or 11 characters long; bbb is optional)
* *
* Validation is case-insensitive. Please make sure to normalize input yourself.
*
* BIC definition in detail: * BIC definition in detail:
* - First 4 characters - bank code (only letters) * - First 4 characters - bank code (only letters)
* - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters) * - Next 2 characters - ISO 3166-1 alpha-2 country code (only letters)
* - Next 2 characters - location code (letters and digits) * - Next 2 characters - location code (letters and digits)
* a. shall not start with '0' or '1' * a. shall not start with '0' or '1'
* b. second character must be a letter ('O' is not allowed) or one of the following digits ('0' for test (therefore not allowed), '1' for passive participant and '2' for active participant) * b. second character must be a letter ('O' is not allowed) or digit ('0' for test (therefore not allowed), '1' denoting passive participant, '2' typically reverse-billing)
* - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits) * - Last 3 characters - branch code, optional (shall not start with 'X' except in case of 'XXX' for primary office) (letters and digits)
*/ */
$.validator.addMethod( "bic", function( value, element ) { $.validator.addMethod( "bic", function( value, element ) {
return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-2])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value ); return this.optional( element ) || /^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test( value.toUpperCase() );
}, "Please specify a valid BIC code" ); }, "Please specify a valid BIC code" );
/* /*
* Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities * Código de identificación fiscal ( CIF ) is the tax identification code for Spanish legal entities
* Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal * Further rules can be found in Spanish on http://es.wikipedia.org/wiki/C%C3%B3digo_de_identificaci%C3%B3n_fiscal
*/ *
$.validator.addMethod( "cifES", function( value ) { * Spanish CIF structure:
"use strict"; *
* [ T ][ P ][ P ][ N ][ N ][ N ][ N ][ N ][ C ]
var num = [], *
controlDigit, sum, i, count, tmp, secondDigit; * Where:
*
value = value.toUpperCase(); * T: 1 character. Kind of Organization Letter: [ABCDEFGHJKLMNPQRSUVW]
* P: 2 characters. Province.
// Quick format test * N: 5 characters. Secuencial Number within the province.
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { * C: 1 character. Control Digit: [0-9A-J].
return false; *
} * [ T ]: Kind of Organizations. Possible values:
*
for ( i = 0; i < 9; i++ ) {
num[ i ] = parseInt( value.charAt( i ), 10 );
}
// Algorithm for checking CIF codes
sum = num[ 2 ] + num[ 4 ] + num[ 6 ];
for ( count = 1; count < 8; count += 2 ) {
tmp = ( 2 * num[ count ] ).toString();
secondDigit = tmp.charAt( 1 );
sum += parseInt( tmp.charAt( 0 ), 10 ) + ( secondDigit === "" ? 0 : parseInt( secondDigit, 10 ) );
}
/* The first (position 1) is a letter following the following criteria:
* A. Corporations * A. Corporations
* B. LLCs * B. LLCs
* C. General partnerships * C. General partnerships
@ -176,15 +177,82 @@ $.validator.addMethod( "cifES", function( value ) {
* S. Organs of State Administration and regions * S. Organs of State Administration and regions
* V. Agrarian Transformation * V. Agrarian Transformation
* W. Permanent establishments of non-resident in Spain * W. Permanent establishments of non-resident in Spain
*
* [ C ]: Control Digit. It can be a number or a letter depending on T value:
* [ T ] --> [ C ]
* ------ ----------
* A Number
* B Number
* E Number
* H Number
* K Letter
* P Letter
* Q Letter
* S Letter
*
*/ */
if ( /^[ABCDEFGHJNPQRSUVW]{1}/.test( value ) ) { $.validator.addMethod( "cifES", function( value, element ) {
sum += ""; "use strict";
controlDigit = 10 - parseInt( sum.charAt( sum.length - 1 ), 10 );
value += controlDigit; if ( this.optional( element ) ) {
return ( num[ 8 ].toString() === String.fromCharCode( 64 + controlDigit ) || num[ 8 ].toString() === value.charAt( value.length - 1 ) ); return true;
} }
var cifRegEx = new RegExp( /^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi );
var letter = value.substring( 0, 1 ), // [ T ]
number = value.substring( 1, 8 ), // [ P ][ P ][ N ][ N ][ N ][ N ][ N ]
control = value.substring( 8, 9 ), // [ C ]
all_sum = 0,
even_sum = 0,
odd_sum = 0,
i, n,
control_digit,
control_letter;
function isOdd( n ) {
return n % 2 === 0;
}
// Quick format test
if ( value.length !== 9 || !cifRegEx.test( value ) ) {
return false; return false;
}
for ( i = 0; i < number.length; i++ ) {
n = parseInt( number[ i ], 10 );
// Odd positions
if ( isOdd( i ) ) {
// Odd positions are multiplied first.
n *= 2;
// If the multiplication is bigger than 10 we need to adjust
odd_sum += n < 10 ? n : n - 9;
// Even positions
// Just sum them
} else {
even_sum += n;
}
}
all_sum = even_sum + odd_sum;
control_digit = ( 10 - ( all_sum ).toString().substr( -1 ) ).toString();
control_digit = parseInt( control_digit, 10 ) > 9 ? "0" : control_digit;
control_letter = "JABCDEFGHI".substr( control_digit, 1 ).toString();
// Control must be a digit
if ( letter.match( /[ABEH]/ ) ) {
return control === control_digit;
// Control must be a letter
} else if ( letter.match( /[KPQS]/ ) ) {
return control === control_letter;
}
// Can be either
return control === control_digit || control === control_letter;
}, "Please specify a valid CIF number." ); }, "Please specify a valid CIF number." );
@ -193,6 +261,7 @@ $.validator.addMethod( "cifES", function( value ) {
* CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation. * CPF numbers have 11 digits in total: 9 numbers followed by 2 check numbers that are being used for validation.
*/ */
$.validator.addMethod( "cpfBR", function( value ) { $.validator.addMethod( "cpfBR", function( value ) {
// Removing special characters from value // Removing special characters from value
value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" ); value = value.replace( /([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g, "" );
@ -209,7 +278,9 @@ $.validator.addMethod("cpfBR", function(value) {
checkResult = function( sum, cn ) { checkResult = function( sum, cn ) {
var result = ( sum * 10 ) % 11; var result = ( sum * 10 ) % 11;
if ((result === 10) || (result === 11)) {result = 0;} if ( ( result === 10 ) || ( result === 11 ) ) {
result = 0;
}
return ( result === cn ); return ( result === cn );
}; };
@ -246,6 +317,47 @@ $.validator.addMethod("cpfBR", function(value) {
}, "Please specify a valid CPF number" ); }, "Please specify a valid CPF number" );
// https://jqueryvalidation.org/creditcard-method/
// based on https://en.wikipedia.org/wiki/Luhn_algorithm
$.validator.addMethod( "creditcard", function( value, element ) {
if ( this.optional( element ) ) {
return "dependency-mismatch";
}
// Accept only spaces, digits and dashes
if ( /[^0-9 \-]+/.test( value ) ) {
return false;
}
var nCheck = 0,
nDigit = 0,
bEven = false,
n, cDigit;
value = value.replace( /\D/g, "" );
// Basing min and max length on
// https://developer.ean.com/general_info/Valid_Credit_Card_Types
if ( value.length < 13 || value.length > 19 ) {
return false;
}
for ( n = value.length - 1; n >= 0; n-- ) {
cDigit = value.charAt( n );
nDigit = parseInt( cDigit, 10 );
if ( bEven ) {
if ( ( nDigit *= 2 ) > 9 ) {
nDigit -= 9;
}
}
nCheck += nDigit;
bEven = !bEven;
}
return ( nCheck % 10 ) === 0;
}, "Please enter a valid credit card number." );
/* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator /* NOTICE: Modified version of Castle.Components.Validator.CreditCardValidator
* Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0 * Redistributed under the the Apache License 2.0 at http://www.apache.org/licenses/LICENSE-2.0
* Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings) * Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
@ -286,31 +398,31 @@ $.validator.addMethod("creditcardtypes", function(value, element, param) {
if ( param.all ) { if ( param.all ) {
validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080; validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
} }
if (validTypes & 0x0001 && /^(5[12345])/.test(value)) { //mastercard if ( validTypes & 0x0001 && /^(5[12345])/.test( value ) ) { // Mastercard
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa if ( validTypes & 0x0002 && /^(4)/.test( value ) ) { // Visa
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0004 && /^(3[47])/.test(value)) { //amex if ( validTypes & 0x0004 && /^(3[47])/.test( value ) ) { // Amex
return value.length === 15; return value.length === 15;
} }
if (validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test(value)) { //dinersclub if ( validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test( value ) ) { // Dinersclub
return value.length === 14; return value.length === 14;
} }
if (validTypes & 0x0010 && /^(2(014|149))/.test(value)) { //enroute if ( validTypes & 0x0010 && /^(2(014|149))/.test( value ) ) { // Enroute
return value.length === 15; return value.length === 15;
} }
if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover if ( validTypes & 0x0020 && /^(6011)/.test( value ) ) { // Discover
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb if ( validTypes & 0x0040 && /^(3)/.test( value ) ) { // Jcb
return value.length === 16; return value.length === 16;
} }
if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb if ( validTypes & 0x0040 && /^(2131|1800)/.test( value ) ) { // Jcb
return value.length === 15; return value.length === 15;
} }
if (validTypes & 0x0080) { //unknown if ( validTypes & 0x0080 ) { // Unknown
return true; return true;
} }
return false; return false;
@ -422,14 +534,17 @@ $.validator.addMethod("giroaccountNL", function(value, element) {
/** /**
* IBAN is the international bank account number. * IBAN is the international bank account number.
* It has a country - specific format, that is checked here too * It has a country - specific format, that is checked here too
*
* Validation is case-insensitive. Please make sure to normalize input yourself.
*/ */
$.validator.addMethod( "iban", function( value, element ) { $.validator.addMethod( "iban", function( value, element ) {
// some quick simple tests to prevent needless work
// Some quick simple tests to prevent needless work
if ( this.optional( element ) ) { if ( this.optional( element ) ) {
return true; return true;
} }
// remove spaces and to upper case // Remove spaces and to upper case
var iban = value.replace( / /g, "" ).toUpperCase(), var iban = value.replace( / /g, "" ).toUpperCase(),
ibancheckdigits = "", ibancheckdigits = "",
leadingZeroes = true, leadingZeroes = true,
@ -437,7 +552,17 @@ $.validator.addMethod("iban", function(value, element) {
cOperator = "", cOperator = "",
countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p; countrycode, ibancheck, charAt, cChar, bbanpattern, bbancountrypatterns, ibanregexp, i, p;
// check the country code and find the country specific format // Check for IBAN code length.
// It contains:
// country code ISO 3166-1 - two letters,
// two check digits,
// Basic Bank Account Number (BBAN) - up to 30 chars
var minimalIBANlength = 5;
if ( iban.length < minimalIBANlength ) {
return false;
}
// Check the country code and find the country specific format
countrycode = iban.substring( 0, 2 ); countrycode = iban.substring( 0, 2 );
bbancountrypatterns = { bbancountrypatterns = {
"AL": "\\d{8}[\\dA-Z]{16}", "AL": "\\d{8}[\\dA-Z]{16}",
@ -507,6 +632,7 @@ $.validator.addMethod("iban", function(value, element) {
}; };
bbanpattern = bbancountrypatterns[ countrycode ]; bbanpattern = bbancountrypatterns[ countrycode ];
// As new countries will start using IBAN in the // As new countries will start using IBAN in the
// future, we only check if the countrycode is known. // future, we only check if the countrycode is known.
// This prevents false negatives, while almost all // This prevents false negatives, while almost all
@ -517,11 +643,11 @@ $.validator.addMethod("iban", function(value, element) {
if ( typeof bbanpattern !== "undefined" ) { if ( typeof bbanpattern !== "undefined" ) {
ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" ); ibanregexp = new RegExp( "^[A-Z]{2}\\d{2}" + bbanpattern + "$", "" );
if ( !( ibanregexp.test( iban ) ) ) { if ( !( ibanregexp.test( iban ) ) ) {
return false; // invalid country specific format return false; // Invalid country specific format
} }
} }
// now check the checksum, first convert to digits // Now check the checksum, first convert to digits
ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 ); ibancheck = iban.substring( 4, iban.length ) + iban.substring( 0, 4 );
for ( i = 0; i < ibancheck.length; i++ ) { for ( i = 0; i < ibancheck.length; i++ ) {
charAt = ibancheck.charAt( i ); charAt = ibancheck.charAt( i );
@ -533,7 +659,7 @@ $.validator.addMethod("iban", function(value, element) {
} }
} }
// calculate the result of: ibancheckdigits % 97 // Calculate the result of: ibancheckdigits % 97
for ( p = 0; p < ibancheckdigits.length; p++ ) { for ( p = 0; p < ibancheckdigits.length; p++ ) {
cChar = ibancheckdigits.charAt( p ); cChar = ibancheckdigits.charAt( p );
cOperator = "" + cRest + "" + cChar; cOperator = "" + cRest + "" + cChar;
@ -580,47 +706,60 @@ $.validator.addMethod("mobileUK", function(phone_number, element) {
phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ ); phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/ );
}, "Please specify a valid mobile number" ); }, "Please specify a valid mobile number" );
$.validator.addMethod( "netmask", function( value, element ) {
return this.optional( element ) || /^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test( value );
}, "Please enter a valid netmask." );
/* /*
* The número de identidad de extranjero ( NIE )is a code used to identify the non-nationals in Spain * The NIE (Número de Identificación de Extranjero) is a Spanish tax identification number assigned by the Spanish
* authorities to any foreigner.
*
* The NIE is the equivalent of a Spaniards Número de Identificación Fiscal (NIF) which serves as a fiscal
* identification number. The CIF number (Certificado de Identificación Fiscal) is equivalent to the NIF, but applies to
* companies rather than individuals. The NIE consists of an 'X' or 'Y' followed by 7 or 8 digits then another letter.
*/ */
$.validator.addMethod( "nieES", function( value ) { $.validator.addMethod( "nieES", function( value, element ) {
"use strict"; "use strict";
value = value.toUpperCase(); if ( this.optional( element ) ) {
return true;
}
// Basic format test var nieRegEx = new RegExp( /^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi );
if ( !value.match( "((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)" ) ) { var validChars = "TRWAGMYFPDXBNJZSQVHLCKET",
letter = value.substr( value.length - 1 ).toUpperCase(),
number;
value = value.toString().toUpperCase();
// Quick format test
if ( value.length > 10 || value.length < 9 || !nieRegEx.test( value ) ) {
return false; return false;
} }
// Test NIE // X means same number
//T // Y means number + 10000000
if ( /^[T]{1}/.test( value ) ) { // Z means number + 20000000
return ( value[ 8 ] === /^[T]{1}[A-Z0-9]{8}$/.test( value ) ); value = value.replace( /^[X]/, "0" )
} .replace( /^[Y]/, "1" )
.replace( /^[Z]/, "2" );
//XYZ number = value.length === 9 ? value.substr( 0, 8 ) : value.substr( 0, 9 );
if ( /^[XYZ]{1}/.test( value ) ) {
return (
value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt(
value.replace( "X", "0" )
.replace( "Y", "1" )
.replace( "Z", "2" )
.substring( 0, 8 ) % 23
)
);
}
return false; return validChars.charAt( parseInt( number, 10 ) % 23 ) === letter;
}, "Please specify a valid NIE number." ); }, "Please specify a valid NIE number." );
/* /*
* The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals * The Número de Identificación Fiscal ( NIF ) is the way tax identification used in Spain for individuals
*/ */
$.validator.addMethod( "nifES", function( value ) { $.validator.addMethod( "nifES", function( value, element ) {
"use strict"; "use strict";
if ( this.optional( element ) ) {
return true;
}
value = value.toUpperCase(); value = value.toUpperCase();
// Basic format test // Basic format test
@ -632,16 +771,40 @@ $.validator.addMethod( "nifES", function( value ) {
if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) { if ( /^[0-9]{8}[A-Z]{1}$/.test( value ) ) {
return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) ); return ( "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 0 ) % 23 ) === value.charAt( 8 ) );
} }
// Test specials NIF (starts with K, L or M) // Test specials NIF (starts with K, L or M)
if ( /^[KLM]{1}/.test( value ) ) { if ( /^[KLM]{1}/.test( value ) ) {
return ( value[ 8 ] === String.fromCharCode( 64 ) ); return ( value[ 8 ] === "TRWAGMYFPDXBNJZSQVHLCKE".charAt( value.substring( 8, 1 ) % 23 ) );
} }
return false; return false;
}, "Please specify a valid NIF number." ); }, "Please specify a valid NIF number." );
jQuery.validator.addMethod( "notEqualTo", function( value, element, param ) { /*
* Numer identyfikacji podatkowej ( NIP ) is the way tax identification used in Poland for companies
*/
$.validator.addMethod( "nipPL", function( value ) {
"use strict";
value = value.replace( /[^0-9]/g, "" );
if ( value.length !== 10 ) {
return false;
}
var arrSteps = [ 6, 5, 7, 2, 3, 4, 5, 6, 7 ];
var intSum = 0;
for ( var i = 0; i < 9; i++ ) {
intSum += arrSteps[ i ] * value[ i ];
}
var int2 = intSum % 11;
var intControlNr = ( int2 === 10 ) ? 0 : int2;
return ( intControlNr === parseInt( value[ 9 ], 10 ) );
}, "Please specify a valid NIP number." );
$.validator.addMethod( "notEqualTo", function( value, element, param ) {
return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param ); return this.optional( element ) || !$.validator.methods.equalTo.call( this, value, element, param );
}, "Please enter a different value, values must not be the same." ); }, "Please enter a different value, values must not be the same." );
@ -679,6 +842,22 @@ $.validator.addMethod("phoneNL", function(value, element) {
return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value ); return this.optional( element ) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test( value );
}, "Please specify a valid phone number." ); }, "Please specify a valid phone number." );
/* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0'
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2.
* A number of very detailed GB telephone number RegEx patterns can also be found at:
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers
*/
// Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
$.validator.addMethod( "phonesUK", function( phone_number, element ) {
phone_number = phone_number.replace( /\(|\)|\s+|-/g, "" );
return this.optional( element ) || phone_number.length > 9 &&
phone_number.match( /^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/ );
}, "Please specify a valid uk phone number" );
/* For UK phone functions, do the following server side processing: /* For UK phone functions, do the following server side processing:
* Compare original input with this RegEx pattern: * Compare original input with this RegEx pattern:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ * ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$
@ -694,7 +873,7 @@ $.validator.addMethod("phoneUK", function(phone_number, element) {
}, "Please specify a valid phone number" ); }, "Please specify a valid phone number" );
/** /**
* matches US phone number format * Matches US phone number format
* *
* where the area code may not start with 1 and the prefix may not start with 1 * where the area code may not start with 1 and the prefix may not start with 1
* allows '-' or ' ' as a separator and allows parens around area code * allows '-' or ' ' as a separator and allows parens around area code
@ -715,20 +894,17 @@ $.validator.addMethod("phoneUS", function(phone_number, element) {
phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ ); phone_number.match( /^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]([02-9]\d|1[02-9])-?\d{4}$/ );
}, "Please specify a valid phone number" ); }, "Please specify a valid phone number" );
/* For UK phone functions, do the following server side processing: /*
* Compare original input with this RegEx pattern: * Valida CEPs do brasileiros:
* ^\(?(?:(?:00\)?[\s\-]?\(?|\+)(44)\)?[\s\-]?\(?(?:0\)?[\s\-]?\(?)?|0)([1-9]\d{1,4}\)?[\s\d\-]+)$ *
* Extract $1 and set $prefix to '+44<space>' if $1 is '44', otherwise set $prefix to '0' * Formatos aceitos:
* Extract $2 and remove hyphens, spaces and parentheses. Phone number is combined $prefix and $2. * 99999-999
* A number of very detailed GB telephone number RegEx patterns can also be found at: * 99.999-999
* http://www.aa-asterisk.org.uk/index.php/Regular_Expressions_for_Validating_and_Formatting_GB_Telephone_Numbers * 99999999
*/ */
//Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers $.validator.addMethod( "postalcodeBR", function( cep_value, element ) {
$.validator.addMethod("phonesUK", function(phone_number, element) { return this.optional( element ) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
phone_number = phone_number.replace(/\(|\)|\s+|-/g, ""); }, "Informe um CEP válido." );
return this.optional(element) || phone_number.length > 9 &&
phone_number.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/);
}, "Please specify a valid uk phone number");
/** /**
* Matches a valid Canadian Postal Code * Matches a valid Canadian Postal Code
@ -744,21 +920,9 @@ $.validator.addMethod("phonesUK", function(phone_number, element) {
* @cat Plugins/Validate/Methods * @cat Plugins/Validate/Methods
*/ */
$.validator.addMethod( "postalCodeCA", function( value, element ) { $.validator.addMethod( "postalCodeCA", function( value, element ) {
return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[A-Z] \d[A-Z]\d$/.test( value ); return this.optional( element ) || /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test( value );
}, "Please specify a valid postal code" ); }, "Please specify a valid postal code" );
/*
* Valida CEPs do brasileiros:
*
* Formatos aceitos:
* 99999-999
* 99.999-999
* 99999999
*/
$.validator.addMethod("postalcodeBR", function(cep_value, element) {
return this.optional(element) || /^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test( cep_value );
}, "Informe um CEP válido.");
/* Matches Italian postcode (CAP) */ /* Matches Italian postcode (CAP) */
$.validator.addMethod( "postalcodeIT", function( value, element ) { $.validator.addMethod( "postalcodeIT", function( value, element ) {
return this.optional( element ) || /^\d{5}$/.test( value ); return this.optional( element ) || /^\d{5}$/.test( value );
@ -888,10 +1052,7 @@ $.validator.addMethod("skip_or_fill_minimum", function(value, element, options)
* includeMilitary: true * includeMilitary: true
* } * }
* *
*
*
*/ */
$.validator.addMethod( "stateUS", function( value, element, options ) { $.validator.addMethod( "stateUS", function( value, element, options ) {
var isDefault = typeof options === "undefined", var isDefault = typeof options === "undefined",
caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive, caseSensitive = ( isDefault || typeof options.caseSensitive === "undefined" ) ? false : options.caseSensitive,
@ -911,8 +1072,7 @@ $.validator.addMethod("stateUS", function(value, element, options) {
regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" ); regex = caseSensitive ? new RegExp( regex ) : new RegExp( regex, "i" );
return this.optional( element ) || regex.test( value ); return this.optional( element ) || regex.test( value );
}, }, "Please specify a valid state" );
"Please specify a valid state");
// TODO check if value starts with <, otherwise don't try stripping anything // TODO check if value starts with <, otherwise don't try stripping anything
$.validator.addMethod( "strippedminlength", function( value, element, param ) { $.validator.addMethod( "strippedminlength", function( value, element, param ) {
@ -927,7 +1087,7 @@ $.validator.addMethod("time12h", function(value, element) {
return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value ); return this.optional( element ) || /^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test( value );
}, "Please enter a valid time in 12-hour am/pm format" ); }, "Please enter a valid time in 12-hour am/pm format" );
// same as url, but TLD is optional // Same as url, but TLD is optional
$.validator.addMethod( "url2", function( value, element ) { $.validator.addMethod( "url2", function( value, element ) {
return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value ); return this.optional( element ) || /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)*(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
}, $.validator.messages.url ); }, $.validator.messages.url );
@ -994,5 +1154,5 @@ $.validator.addMethod("zipcodeUS", function(value, element) {
$.validator.addMethod( "ziprange", function( value, element ) { $.validator.addMethod( "ziprange", function( value, element ) {
return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value ); return this.optional( element ) || /^90[2-5]\d\{2\}-\d{4}$/.test( value );
}, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" ); }, "Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx" );
return $;
})); }));

View File

@ -167,7 +167,7 @@ externally maintained libraries used by this software which have their
own licenses; we recommend you read them, as their terms may differ from own licenses; we recommend you read them, as their terms may differ from
the terms above. the terms above.
License notice for jQuery Validation v1.14.0 License notice for jQuery Validation v1.17.0
-------------------------------------------- --------------------------------------------
The MIT License (MIT) The MIT License (MIT)
===================== =====================

View File

@ -66,8 +66,11 @@
"wwwroot/lib/jquery-validation/.bower.json", "wwwroot/lib/jquery-validation/.bower.json",
"wwwroot/lib/jquery-validation/LICENSE.md", "wwwroot/lib/jquery-validation/LICENSE.md",
"wwwroot/lib/jquery-validation/dist/additional-methods.js", "wwwroot/lib/jquery-validation/dist/additional-methods.js",
"wwwroot/lib/jquery-validation/dist/additional-methods.min.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -132,8 +135,11 @@
"wwwroot/lib/jquery-validation/.bower.json", "wwwroot/lib/jquery-validation/.bower.json",
"wwwroot/lib/jquery-validation/LICENSE.md", "wwwroot/lib/jquery-validation/LICENSE.md",
"wwwroot/lib/jquery-validation/dist/additional-methods.js", "wwwroot/lib/jquery-validation/dist/additional-methods.js",
"wwwroot/lib/jquery-validation/dist/additional-methods.min.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -199,8 +205,11 @@
"wwwroot/lib/jquery-validation/.bower.json", "wwwroot/lib/jquery-validation/.bower.json",
"wwwroot/lib/jquery-validation/LICENSE.md", "wwwroot/lib/jquery-validation/LICENSE.md",
"wwwroot/lib/jquery-validation/dist/additional-methods.js", "wwwroot/lib/jquery-validation/dist/additional-methods.js",
"wwwroot/lib/jquery-validation/dist/additional-methods.min.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -266,8 +275,11 @@
"wwwroot/lib/jquery-validation/.bower.json", "wwwroot/lib/jquery-validation/.bower.json",
"wwwroot/lib/jquery-validation/LICENSE.md", "wwwroot/lib/jquery-validation/LICENSE.md",
"wwwroot/lib/jquery-validation/dist/additional-methods.js", "wwwroot/lib/jquery-validation/dist/additional-methods.js",
"wwwroot/lib/jquery-validation/dist/additional-methods.min.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -332,8 +344,11 @@
"wwwroot/lib/jquery-validation/.bower.json", "wwwroot/lib/jquery-validation/.bower.json",
"wwwroot/lib/jquery-validation/LICENSE.md", "wwwroot/lib/jquery-validation/LICENSE.md",
"wwwroot/lib/jquery-validation/dist/additional-methods.js", "wwwroot/lib/jquery-validation/dist/additional-methods.js",
"wwwroot/lib/jquery-validation/dist/additional-methods.min.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -399,8 +414,11 @@
"wwwroot/lib/jquery-validation/.bower.json", "wwwroot/lib/jquery-validation/.bower.json",
"wwwroot/lib/jquery-validation/LICENSE.md", "wwwroot/lib/jquery-validation/LICENSE.md",
"wwwroot/lib/jquery-validation/dist/additional-methods.js", "wwwroot/lib/jquery-validation/dist/additional-methods.js",
"wwwroot/lib/jquery-validation/dist/additional-methods.min.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -428,7 +446,6 @@
"appsettings.Development.json", "appsettings.Development.json",
"appsettings.json", "appsettings.json",
"Program.cs", "Program.cs",
"Startup.cs", "Startup.cs",
"Controllers/ValuesController.cs", "Controllers/ValuesController.cs",
"Properties/launchSettings.json" "Properties/launchSettings.json"
@ -456,7 +473,6 @@
"appsettings.json", "appsettings.json",
"Program.cs", "Program.cs",
"Startup.cs", "Startup.cs",
"Controllers/ValuesController.cs", "Controllers/ValuesController.cs",
"Properties/launchSettings.json" "Properties/launchSettings.json"
], ],
@ -531,6 +547,7 @@
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -596,6 +613,7 @@
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -662,6 +680,7 @@
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -728,6 +747,7 @@
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -793,6 +813,7 @@
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],
@ -859,6 +880,7 @@
"wwwroot/lib/jquery-validation/dist/jquery.validate.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.js",
"wwwroot/lib/jquery-validation/dist/jquery.validate.min.js", "wwwroot/lib/jquery-validation/dist/jquery.validate.min.js",
"wwwroot/lib/jquery-validation-unobtrusive/.bower.json", "wwwroot/lib/jquery-validation-unobtrusive/.bower.json",
"wwwroot/lib/jquery-validation-unobtrusive/LICENSE.txt",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js", "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js",
"wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js" "wwwroot/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
], ],