界面框架初步提交
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
[jQuery Validation Plugin](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) - Form validation made easy
|
||||
================================
|
||||
|
||||
[](http://travis-ci.org/jzaefferer/jquery-validation)
|
||||
|
||||
The jQuery Validation Plugin provides drop-in validation for your existing forms, while making all kinds of customizations to fit your application really easy.
|
||||
|
||||
## [Help the project](http://pledgie.com/campaigns/18159)
|
||||
|
||||
[](http://pledgie.com/campaigns/18159)
|
||||
|
||||
This project is looking for help! [You can donate to the ongoing pledgie campaign](http://pledgie.com/campaigns/18159)
|
||||
and help spread the word. If you've used the plugin, or plan to use, consider a donation - any amount will help.
|
||||
|
||||
You can find the plan for how to spend the money on the [pledgie page](http://pledgie.com/campaigns/18159).
|
||||
|
||||
## Getting Started
|
||||
|
||||
Include jQuery and the plugin on a page. Then select a form to validate and call the `validate` method.
|
||||
|
||||
```html
|
||||
<form>
|
||||
<input required>
|
||||
</form>
|
||||
<script src="jquery.js"></script>
|
||||
<script src="jquery.validation.js"></script>
|
||||
<script>
|
||||
$("form").validate();
|
||||
</script>
|
||||
```
|
||||
|
||||
For more information on how to setup a rules and customizations, [check the documentation](http://docs.jquery.com/Plugins/Validation).
|
||||
|
||||
## Contributing
|
||||
Follow the [jQuery style guide](http://contribute.jquery.com/style-guides/js), even if existing code doesn't. Add unit tests for any new or changed functionality. Lint and test your code using [grunt](https://github.com/gruntjs/grunt/).
|
||||
|
||||
If you've wrote custom methods that you'd like to contribute to additional-methods.js, create a branch, add the method there and send a pull request for that branch.
|
||||
|
||||
## License
|
||||
Copyright (c) 2013 Jörn Zaefferer
|
||||
Licensed under the MIT license.
|
||||
@@ -0,0 +1,617 @@
|
||||
/*!
|
||||
* jQuery Validation Plugin 1.11.1
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
|
||||
* http://docs.jquery.com/Plugins/Validation
|
||||
*
|
||||
* Copyright 2013 Jörn Zaefferer
|
||||
* Released under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
function stripHtml(value) {
|
||||
// remove html tags and space chars
|
||||
return value.replace(/<.[^<>]*?>/g, ' ').replace(/ | /gi, ' ')
|
||||
// remove punctuation
|
||||
.replace(/[.(),;:!?%#$'"_+=\/\-]*/g,'');
|
||||
}
|
||||
jQuery.validator.addMethod("maxWords", function(value, element, params) {
|
||||
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length <= params;
|
||||
}, jQuery.validator.format("Please enter {0} words or less."));
|
||||
|
||||
jQuery.validator.addMethod("minWords", function(value, element, params) {
|
||||
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params;
|
||||
}, jQuery.validator.format("Please enter at least {0} words."));
|
||||
|
||||
jQuery.validator.addMethod("rangeWords", function(value, element, params) {
|
||||
var valueStripped = stripHtml(value);
|
||||
var regex = /\b\w+\b/g;
|
||||
return this.optional(element) || valueStripped.match(regex).length >= params[0] && valueStripped.match(regex).length <= params[1];
|
||||
}, jQuery.validator.format("Please enter between {0} and {1} words."));
|
||||
|
||||
}());
|
||||
|
||||
jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
|
||||
return this.optional(element) || /^[a-z\-.,()'"\s]+$/i.test(value);
|
||||
}, "Letters or punctuation only please");
|
||||
|
||||
jQuery.validator.addMethod("alphanumeric", function(value, element) {
|
||||
return this.optional(element) || /^\w+$/i.test(value);
|
||||
}, "Letters, numbers, and underscores only please");
|
||||
|
||||
jQuery.validator.addMethod("lettersonly", function(value, element) {
|
||||
return this.optional(element) || /^[a-z]+$/i.test(value);
|
||||
}, "Letters only please");
|
||||
|
||||
jQuery.validator.addMethod("nowhitespace", function(value, element) {
|
||||
return this.optional(element) || /^\S+$/i.test(value);
|
||||
}, "No white space please");
|
||||
|
||||
jQuery.validator.addMethod("ziprange", function(value, element) {
|
||||
return this.optional(element) || /^90[2-5]\d\{2\}-\d{4}$/.test(value);
|
||||
}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");
|
||||
|
||||
jQuery.validator.addMethod("zipcodeUS", function(value, element) {
|
||||
return this.optional(element) || /\d{5}-\d{4}$|^\d{5}$/.test(value);
|
||||
}, "The specified US ZIP Code is invalid");
|
||||
|
||||
jQuery.validator.addMethod("integer", function(value, element) {
|
||||
return this.optional(element) || /^-?\d+$/.test(value);
|
||||
}, "A positive or negative non-decimal number please");
|
||||
|
||||
/**
|
||||
* Return true, if the value is a valid vehicle identification number (VIN).
|
||||
*
|
||||
* Works with all kind of text inputs.
|
||||
*
|
||||
* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
|
||||
* @desc Declares a required input element whose value must be a valid vehicle identification number.
|
||||
*
|
||||
* @name jQuery.validator.methods.vinUS
|
||||
* @type Boolean
|
||||
* @cat Plugins/Validate/Methods
|
||||
*/
|
||||
jQuery.validator.addMethod("vinUS", function(v) {
|
||||
if (v.length !== 17) {
|
||||
return false;
|
||||
}
|
||||
var i, n, d, f, cd, cdv;
|
||||
var LL = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
|
||||
var VL = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
|
||||
var FL = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
|
||||
var rs = 0;
|
||||
for(i = 0; i < 17; i++){
|
||||
f = FL[i];
|
||||
d = v.slice(i,i+1);
|
||||
if (i === 8) {
|
||||
cdv = d;
|
||||
}
|
||||
if (!isNaN(d)) {
|
||||
d *= f;
|
||||
} else {
|
||||
for (n = 0; n < LL.length; n++) {
|
||||
if (d.toUpperCase() === LL[n]) {
|
||||
d = VL[n];
|
||||
d *= f;
|
||||
if (isNaN(cdv) && n === 8) {
|
||||
cdv = LL[n];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
rs += d;
|
||||
}
|
||||
cd = rs % 11;
|
||||
if (cd === 10) {
|
||||
cd = "X";
|
||||
}
|
||||
if (cd === cdv) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, "The specified vehicle identification number (VIN) is invalid.");
|
||||
|
||||
/**
|
||||
* Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
|
||||
*
|
||||
* @example jQuery.validator.methods.date("01/01/1900")
|
||||
* @result true
|
||||
*
|
||||
* @example jQuery.validator.methods.date("01/13/1990")
|
||||
* @result false
|
||||
*
|
||||
* @example jQuery.validator.methods.date("01.01.1900")
|
||||
* @result false
|
||||
*
|
||||
* @example <input name="pippo" class="{dateITA:true}" />
|
||||
* @desc Declares an optional input element whose value must be a valid date.
|
||||
*
|
||||
* @name jQuery.validator.methods.dateITA
|
||||
* @type Boolean
|
||||
* @cat Plugins/Validate/Methods
|
||||
*/
|
||||
jQuery.validator.addMethod("dateITA", function(value, element) {
|
||||
var check = false;
|
||||
var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
|
||||
if( re.test(value)) {
|
||||
var adata = value.split('/');
|
||||
var gg = parseInt(adata[0],10);
|
||||
var mm = parseInt(adata[1],10);
|
||||
var aaaa = parseInt(adata[2],10);
|
||||
var xdata = new Date(aaaa,mm-1,gg);
|
||||
if ( ( xdata.getFullYear() === aaaa ) && ( xdata.getMonth() === mm - 1 ) && ( xdata.getDate() === gg ) ){
|
||||
check = true;
|
||||
} else {
|
||||
check = false;
|
||||
}
|
||||
} else {
|
||||
check = false;
|
||||
}
|
||||
return this.optional(element) || check;
|
||||
}, "Please enter a correct date");
|
||||
|
||||
/**
|
||||
* IBAN is the international bank account number.
|
||||
* It has a country - specific format, that is checked here too
|
||||
*/
|
||||
jQuery.validator.addMethod("iban", function(value, element) {
|
||||
// some quick simple tests to prevent needless work
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
if (!(/^([a-zA-Z0-9]{4} ){2,8}[a-zA-Z0-9]{1,4}|[a-zA-Z0-9]{12,34}$/.test(value))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check the country code and find the country specific format
|
||||
var iban = value.replace(/ /g,'').toUpperCase(); // remove spaces and to upper case
|
||||
var countrycode = iban.substring(0,2);
|
||||
var bbancountrypatterns = {
|
||||
'AL': "\\d{8}[\\dA-Z]{16}",
|
||||
'AD': "\\d{8}[\\dA-Z]{12}",
|
||||
'AT': "\\d{16}",
|
||||
'AZ': "[\\dA-Z]{4}\\d{20}",
|
||||
'BE': "\\d{12}",
|
||||
'BH': "[A-Z]{4}[\\dA-Z]{14}",
|
||||
'BA': "\\d{16}",
|
||||
'BR': "\\d{23}[A-Z][\\dA-Z]",
|
||||
'BG': "[A-Z]{4}\\d{6}[\\dA-Z]{8}",
|
||||
'CR': "\\d{17}",
|
||||
'HR': "\\d{17}",
|
||||
'CY': "\\d{8}[\\dA-Z]{16}",
|
||||
'CZ': "\\d{20}",
|
||||
'DK': "\\d{14}",
|
||||
'DO': "[A-Z]{4}\\d{20}",
|
||||
'EE': "\\d{16}",
|
||||
'FO': "\\d{14}",
|
||||
'FI': "\\d{14}",
|
||||
'FR': "\\d{10}[\\dA-Z]{11}\\d{2}",
|
||||
'GE': "[\\dA-Z]{2}\\d{16}",
|
||||
'DE': "\\d{18}",
|
||||
'GI': "[A-Z]{4}[\\dA-Z]{15}",
|
||||
'GR': "\\d{7}[\\dA-Z]{16}",
|
||||
'GL': "\\d{14}",
|
||||
'GT': "[\\dA-Z]{4}[\\dA-Z]{20}",
|
||||
'HU': "\\d{24}",
|
||||
'IS': "\\d{22}",
|
||||
'IE': "[\\dA-Z]{4}\\d{14}",
|
||||
'IL': "\\d{19}",
|
||||
'IT': "[A-Z]\\d{10}[\\dA-Z]{12}",
|
||||
'KZ': "\\d{3}[\\dA-Z]{13}",
|
||||
'KW': "[A-Z]{4}[\\dA-Z]{22}",
|
||||
'LV': "[A-Z]{4}[\\dA-Z]{13}",
|
||||
'LB': "\\d{4}[\\dA-Z]{20}",
|
||||
'LI': "\\d{5}[\\dA-Z]{12}",
|
||||
'LT': "\\d{16}",
|
||||
'LU': "\\d{3}[\\dA-Z]{13}",
|
||||
'MK': "\\d{3}[\\dA-Z]{10}\\d{2}",
|
||||
'MT': "[A-Z]{4}\\d{5}[\\dA-Z]{18}",
|
||||
'MR': "\\d{23}",
|
||||
'MU': "[A-Z]{4}\\d{19}[A-Z]{3}",
|
||||
'MC': "\\d{10}[\\dA-Z]{11}\\d{2}",
|
||||
'MD': "[\\dA-Z]{2}\\d{18}",
|
||||
'ME': "\\d{18}",
|
||||
'NL': "[A-Z]{4}\\d{10}",
|
||||
'NO': "\\d{11}",
|
||||
'PK': "[\\dA-Z]{4}\\d{16}",
|
||||
'PS': "[\\dA-Z]{4}\\d{21}",
|
||||
'PL': "\\d{24}",
|
||||
'PT': "\\d{21}",
|
||||
'RO': "[A-Z]{4}[\\dA-Z]{16}",
|
||||
'SM': "[A-Z]\\d{10}[\\dA-Z]{12}",
|
||||
'SA': "\\d{2}[\\dA-Z]{18}",
|
||||
'RS': "\\d{18}",
|
||||
'SK': "\\d{20}",
|
||||
'SI': "\\d{15}",
|
||||
'ES': "\\d{20}",
|
||||
'SE': "\\d{20}",
|
||||
'CH': "\\d{5}[\\dA-Z]{12}",
|
||||
'TN': "\\d{20}",
|
||||
'TR': "\\d{5}[\\dA-Z]{17}",
|
||||
'AE': "\\d{3}\\d{16}",
|
||||
'GB': "[A-Z]{4}\\d{14}",
|
||||
'VG': "[\\dA-Z]{4}\\d{16}"
|
||||
};
|
||||
var bbanpattern = bbancountrypatterns[countrycode];
|
||||
// As new countries will start using IBAN in the
|
||||
// future, we only check if the countrycode is known.
|
||||
// This prevents false negatives, while almost all
|
||||
// false positives introduced by this, will be caught
|
||||
// by the checksum validation below anyway.
|
||||
// Strict checking should return FALSE for unknown
|
||||
// countries.
|
||||
if (typeof bbanpattern !== 'undefined') {
|
||||
var ibanregexp = new RegExp("^[A-Z]{2}\\d{2}" + bbanpattern + "$", "");
|
||||
if (!(ibanregexp.test(iban))) {
|
||||
return false; // invalid country specific format
|
||||
}
|
||||
}
|
||||
|
||||
// now check the checksum, first convert to digits
|
||||
var ibancheck = iban.substring(4,iban.length) + iban.substring(0,4);
|
||||
var ibancheckdigits = "";
|
||||
var leadingZeroes = true;
|
||||
var charAt;
|
||||
for (var i =0; i<ibancheck.length; i++) {
|
||||
charAt = ibancheck.charAt(i);
|
||||
if (charAt !== "0") {
|
||||
leadingZeroes = false;
|
||||
}
|
||||
if (!leadingZeroes) {
|
||||
ibancheckdigits += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(charAt);
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the result of: ibancheckdigits % 97
|
||||
var cRest = '';
|
||||
var cOperator = '';
|
||||
for (var p=0; p<ibancheckdigits.length; p++) {
|
||||
var cChar = ibancheckdigits.charAt(p);
|
||||
cOperator = '' + cRest + '' + cChar;
|
||||
cRest = cOperator % 97;
|
||||
}
|
||||
return cRest === 1;
|
||||
}, "Please specify a valid IBAN");
|
||||
|
||||
jQuery.validator.addMethod("dateNL", function(value, element) {
|
||||
return this.optional(element) || /^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(value);
|
||||
}, "Please enter a correct date");
|
||||
|
||||
/**
|
||||
* Dutch phone numbers have 10 digits (or 11 and start with +31).
|
||||
*/
|
||||
jQuery.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);
|
||||
}, "Please specify a valid phone number.");
|
||||
|
||||
jQuery.validator.addMethod("mobileNL", function(value, element) {
|
||||
return this.optional(element) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(value);
|
||||
}, "Please specify a valid mobile number");
|
||||
|
||||
jQuery.validator.addMethod("postalcodeNL", function(value, element) {
|
||||
return this.optional(element) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(value);
|
||||
}, "Please specify a valid postal code");
|
||||
|
||||
/*
|
||||
* Dutch bank account numbers (not 'giro' numbers) have 9 digits
|
||||
* and pass the '11 check'.
|
||||
* We accept the notation with spaces, as that is common.
|
||||
* acceptable: 123456789 or 12 34 56 789
|
||||
*/
|
||||
jQuery.validator.addMethod("bankaccountNL", function(value, element) {
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
if (!(/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(value))) {
|
||||
return false;
|
||||
}
|
||||
// now '11 check'
|
||||
var account = value.replace(/ /g,''); // remove spaces
|
||||
var sum = 0;
|
||||
var len = account.length;
|
||||
for (var pos=0; pos<len; pos++) {
|
||||
var factor = len - pos;
|
||||
var digit = account.substring(pos, pos+1);
|
||||
sum = sum + factor * digit;
|
||||
}
|
||||
return sum % 11 === 0;
|
||||
}, "Please specify a valid bank account number");
|
||||
|
||||
/**
|
||||
* Dutch giro account numbers (not bank numbers) have max 7 digits
|
||||
*/
|
||||
jQuery.validator.addMethod("giroaccountNL", function(value, element) {
|
||||
return this.optional(element) || /^[0-9]{1,7}$/.test(value);
|
||||
}, "Please specify a valid giro account number");
|
||||
|
||||
jQuery.validator.addMethod("bankorgiroaccountNL", function(value, element) {
|
||||
return this.optional(element) ||
|
||||
($.validator.methods["bankaccountNL"].call(this, value, element)) ||
|
||||
($.validator.methods["giroaccountNL"].call(this, value, element));
|
||||
}, "Please specify a valid bank or giro account number");
|
||||
|
||||
|
||||
jQuery.validator.addMethod("time", function(value, element) {
|
||||
return this.optional(element) || /^([01]\d|2[0-3])(:[0-5]\d){1,2}$/.test(value);
|
||||
}, "Please enter a valid time, between 00:00 and 23:59");
|
||||
jQuery.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);
|
||||
}, "Please enter a valid time in 12-hour am/pm format");
|
||||
|
||||
/**
|
||||
* matches US phone number format
|
||||
*
|
||||
* 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
|
||||
* some people may want to put a '1' in front of their number
|
||||
*
|
||||
* 1(212)-999-2345 or
|
||||
* 212 999 2344 or
|
||||
* 212-999-0983
|
||||
*
|
||||
* but not
|
||||
* 111-123-5434
|
||||
* and not
|
||||
* 212 123 4567
|
||||
*/
|
||||
jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
|
||||
phone_number = phone_number.replace(/\s+/g, "");
|
||||
return this.optional(element) || phone_number.length > 9 &&
|
||||
phone_number.match(/^(\+?1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
|
||||
}, "Please specify a valid phone number");
|
||||
|
||||
jQuery.validator.addMethod('phoneUK', 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))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/);
|
||||
}, 'Please specify a valid phone number');
|
||||
|
||||
jQuery.validator.addMethod('mobileUK', 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)7(?:[45789]\d{2}|624)\s?\d{3}\s?\d{3})$/);
|
||||
}, 'Please specify a valid mobile number');
|
||||
|
||||
//Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
|
||||
jQuery.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(?:[45789]\d{8}|624\d{6})))$/);
|
||||
}, 'Please specify a valid uk phone number');
|
||||
// On the above three UK 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 postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK)
|
||||
jQuery.validator.addMethod('postcodeUK', function(value, element) {
|
||||
return this.optional(element) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(value);
|
||||
}, 'Please specify a valid UK postcode');
|
||||
|
||||
// TODO check if value starts with <, otherwise don't try stripping anything
|
||||
jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
|
||||
return jQuery(value).text().length >= param;
|
||||
}, jQuery.validator.format("Please enter at least {0} characters"));
|
||||
|
||||
// same as email, but TLD is optional
|
||||
jQuery.validator.addMethod("email2", function(value, element, param) {
|
||||
return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([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])))\.?$/i.test(value);
|
||||
}, jQuery.validator.messages.email);
|
||||
|
||||
// same as url, but TLD is optional
|
||||
jQuery.validator.addMethod("url2", function(value, element, param) {
|
||||
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);
|
||||
}, jQuery.validator.messages.url);
|
||||
|
||||
// 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
|
||||
// Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
|
||||
jQuery.validator.addMethod("creditcardtypes", function(value, element, param) {
|
||||
if (/[^0-9\-]+/.test(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = value.replace(/\D/g, "");
|
||||
|
||||
var validTypes = 0x0000;
|
||||
|
||||
if (param.mastercard) {
|
||||
validTypes |= 0x0001;
|
||||
}
|
||||
if (param.visa) {
|
||||
validTypes |= 0x0002;
|
||||
}
|
||||
if (param.amex) {
|
||||
validTypes |= 0x0004;
|
||||
}
|
||||
if (param.dinersclub) {
|
||||
validTypes |= 0x0008;
|
||||
}
|
||||
if (param.enroute) {
|
||||
validTypes |= 0x0010;
|
||||
}
|
||||
if (param.discover) {
|
||||
validTypes |= 0x0020;
|
||||
}
|
||||
if (param.jcb) {
|
||||
validTypes |= 0x0040;
|
||||
}
|
||||
if (param.unknown) {
|
||||
validTypes |= 0x0080;
|
||||
}
|
||||
if (param.all) {
|
||||
validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
|
||||
}
|
||||
if (validTypes & 0x0001 && /^(5[12345])/.test(value)) { //mastercard
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0004 && /^(3[47])/.test(value)) { //amex
|
||||
return value.length === 15;
|
||||
}
|
||||
if (validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test(value)) { //dinersclub
|
||||
return value.length === 14;
|
||||
}
|
||||
if (validTypes & 0x0010 && /^(2(014|149))/.test(value)) { //enroute
|
||||
return value.length === 15;
|
||||
}
|
||||
if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb
|
||||
return value.length === 15;
|
||||
}
|
||||
if (validTypes & 0x0080) { //unknown
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, "Please enter a valid credit card number.");
|
||||
|
||||
jQuery.validator.addMethod("ipv4", function(value, element, param) {
|
||||
return this.optional(element) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(value);
|
||||
}, "Please enter a valid IP v4 address.");
|
||||
|
||||
jQuery.validator.addMethod("ipv6", function(value, element, param) {
|
||||
return this.optional(element) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(value);
|
||||
}, "Please enter a valid IP v6 address.");
|
||||
|
||||
/**
|
||||
* Return true if the field value matches the given format RegExp
|
||||
*
|
||||
* @example jQuery.validator.methods.pattern("AR1004",element,/^AR\d{4}$/)
|
||||
* @result true
|
||||
*
|
||||
* @example jQuery.validator.methods.pattern("BR1004",element,/^AR\d{4}$/)
|
||||
* @result false
|
||||
*
|
||||
* @name jQuery.validator.methods.pattern
|
||||
* @type Boolean
|
||||
* @cat Plugins/Validate/Methods
|
||||
*/
|
||||
jQuery.validator.addMethod("pattern", function(value, element, param) {
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
if (typeof param === 'string') {
|
||||
param = new RegExp('^(?:' + param + ')$');
|
||||
}
|
||||
return param.test(value);
|
||||
}, "Invalid format.");
|
||||
|
||||
|
||||
/*
|
||||
* Lets you say "at least X inputs that match selector Y must be filled."
|
||||
*
|
||||
* The end result is that neither of these inputs:
|
||||
*
|
||||
* <input class="productinfo" name="partnumber">
|
||||
* <input class="productinfo" name="description">
|
||||
*
|
||||
* ...will validate unless at least one of them is filled.
|
||||
*
|
||||
* partnumber: {require_from_group: [1,".productinfo"]},
|
||||
* description: {require_from_group: [1,".productinfo"]}
|
||||
*
|
||||
*/
|
||||
jQuery.validator.addMethod("require_from_group", function(value, element, options) {
|
||||
var validator = this;
|
||||
var selector = options[1];
|
||||
var validOrNot = $(selector, element.form).filter(function() {
|
||||
return validator.elementValue(this);
|
||||
}).length >= options[0];
|
||||
|
||||
if(!$(element).data('being_validated')) {
|
||||
var fields = $(selector, element.form);
|
||||
fields.data('being_validated', true);
|
||||
fields.valid();
|
||||
fields.data('being_validated', false);
|
||||
}
|
||||
return validOrNot;
|
||||
}, jQuery.format("Please fill at least {0} of these fields."));
|
||||
|
||||
/*
|
||||
* Lets you say "either at least X inputs that match selector Y must be filled,
|
||||
* OR they must all be skipped (left blank)."
|
||||
*
|
||||
* The end result, is that none of these inputs:
|
||||
*
|
||||
* <input class="productinfo" name="partnumber">
|
||||
* <input class="productinfo" name="description">
|
||||
* <input class="productinfo" name="color">
|
||||
*
|
||||
* ...will validate unless either at least two of them are filled,
|
||||
* OR none of them are.
|
||||
*
|
||||
* partnumber: {skip_or_fill_minimum: [2,".productinfo"]},
|
||||
* description: {skip_or_fill_minimum: [2,".productinfo"]},
|
||||
* color: {skip_or_fill_minimum: [2,".productinfo"]}
|
||||
*
|
||||
*/
|
||||
jQuery.validator.addMethod("skip_or_fill_minimum", function(value, element, options) {
|
||||
var validator = this,
|
||||
numberRequired = options[0],
|
||||
selector = options[1];
|
||||
var numberFilled = $(selector, element.form).filter(function() {
|
||||
return validator.elementValue(this);
|
||||
}).length;
|
||||
var valid = numberFilled >= numberRequired || numberFilled === 0;
|
||||
|
||||
if(!$(element).data('being_validated')) {
|
||||
var fields = $(selector, element.form);
|
||||
fields.data('being_validated', true);
|
||||
fields.valid();
|
||||
fields.data('being_validated', false);
|
||||
}
|
||||
return valid;
|
||||
}, jQuery.format("Please either skip these fields or fill at least {0} of them."));
|
||||
|
||||
// Accept a value from a file input based on a required mimetype
|
||||
jQuery.validator.addMethod("accept", function(value, element, param) {
|
||||
// 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/*",
|
||||
optionalValue = this.optional(element),
|
||||
i, file;
|
||||
|
||||
// Element is optional
|
||||
if (optionalValue) {
|
||||
return optionalValue;
|
||||
}
|
||||
|
||||
if ($(element).attr("type") === "file") {
|
||||
// If we are using a wildcard, make it regex friendly
|
||||
typeParam = typeParam.replace(/\*/g, ".*");
|
||||
|
||||
// Check if the element has a FileList before checking each file
|
||||
if (element.files && element.files.length) {
|
||||
for (i = 0; i < element.files.length; i++) {
|
||||
file = element.files[i];
|
||||
|
||||
// Grab the mimetype from the loaded file, verify it matches
|
||||
if (!file.type.match(new RegExp( ".?(" + typeParam + ")$", "i"))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Either return true because we've validated each file, or because the
|
||||
// browser does not support element.files and the FileList feature
|
||||
return true;
|
||||
}, jQuery.format("Please enter a value with a valid mimetype."));
|
||||
|
||||
// Older "accept" file extension method. Old docs: http://docs.jquery.com/Plugins/Validation/Methods/accept
|
||||
jQuery.validator.addMethod("extension", function(value, element, param) {
|
||||
param = typeof param === "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
|
||||
return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
|
||||
}, jQuery.format("Please enter a value with a valid extension."));
|
||||
2
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/additional-methods.min.js
vendored
Normal file
2
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/additional-methods.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,361 @@
|
||||
|
||||
1.11.0 / 2013-02-04
|
||||
==================
|
||||
|
||||
* Remove clearing as numbers of `min`, `max` and `range` rules. Fixes #455. Closes gh-528.
|
||||
* Update pre-existing labels - fixes #430 closes gh-436
|
||||
* Fix $.validator.format to avoid group interpolation, where at least IE8/9 replaces -bash with the match. Fixes #614
|
||||
* Fix mimetype regex
|
||||
* Add plugin manifest and update headers to just MIT license, drop unnecessary dual-licensing (like jQuery).
|
||||
* Hebrew messages: Removed dots at end of sentences - Fixes gh-568
|
||||
* French translation for require_from_group validation. Fixes gh-573.
|
||||
* Allow groups to be an array or a string - Fixes #479
|
||||
* Removed spaces with multiple MIME types
|
||||
* Fix some date validations, JS syntax errors.
|
||||
* Remove support for metadata plugin, replace with data-rule- and data-msg- (added in 907467e8) properties.
|
||||
* Added sftp as a valid url-pattern
|
||||
* Add Malay (my) localization
|
||||
* Update localization/messages_hu.js
|
||||
* Remove focusin/focusout polyfill. Fixes #542 - Inclusion of jquery.validate interfers with focusin and focusout events in IE9
|
||||
* Localization: Fixed typo in finnish translation
|
||||
* Fix RTM demo to show invalid icon when going from valid back to invalid
|
||||
* Fixed premature return in remote function which prevented ajax call from being made in case an input was entered too quickly. Ensures remote validation always validates the newest value.
|
||||
* Undo fix for #244. Fixes #521 - E-mail validation fires immediately when text is in the field.
|
||||
|
||||
1.10.0 / 2012-09-07
|
||||
===================
|
||||
|
||||
* Corrected French strings for nowhitespace, phoneUS, phoneUK and mobileUK based upon community feedback.
|
||||
* rename files for language_REGION according to the standard ISO_3166-1 (http://en.wikipedia.org/wiki/ISO_3166-1), for Taiwan tha language is Chinese (zh) and the region is Taiwan (TW)
|
||||
* Optimise RegEx patterns, especially for UK phone numbers.
|
||||
* Add Language Name for each file, rename the language code according to the standard ISO 639 for Estonian, Georgian, Ukrainian and Chinese (http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)
|
||||
* Added croatian (HR) localization
|
||||
* Existing French translations were edited and French translations for the additional methods were added.
|
||||
* Merged in changes for specifying custom error messages in data attributes
|
||||
* Updated UK Mobile phone number regex for new numbers. Fixes #154
|
||||
* Add element to success call with test. Fixes #60
|
||||
* Fixed regex for time additional method. Fixes #131
|
||||
* resetForm now clears old previousValue on form elements. Fixes #312
|
||||
* Added checkbox test to require_from_group and changed require_from_group to use elementValue. Fixes #359
|
||||
* Fixed dataFilter response issues in jQuery 1.5.2+. Fixes #405
|
||||
* Added jQuery Mobile demo. Fixes #249
|
||||
* Deoptimize findByName for correctness. Fixes #82 - $.validator.prototype.findByName breaks in IE7
|
||||
* Added US zip code support and test. Fixes #90
|
||||
* Changed lastElement to lastActive in keyup, skip validation on tab or empty element. Fixes #244
|
||||
* Removed number stripping from stripHtml. Fixes #2
|
||||
* Fixed invalid count on invalid to valid remote validation. Fixes #286
|
||||
* Add link to file_input to demo index
|
||||
* Moved old accept method to extension additional-method, added new accept method to handle standard browser mimetype filtering. Fixes #287 and supersedes #369
|
||||
* Disables blur event when onfocusout is set to false. Test added.
|
||||
* Fixed value issue for radio buttons and checkboxes. Fixes #363
|
||||
* Added test for rangeWords and fixed regex and bounds in method. Fixes #308
|
||||
* Fixed TinyMCE Demo and added link on demo page. Fixes #382
|
||||
* Changed localization message for min/max. Fixes #273
|
||||
* Added pseudo selector for text input types to fix issue with default empty type attribute. Added tests and some test markup. Fixes #217
|
||||
* Fixed delegate bug for dynamic-totals demo. Fixes #51
|
||||
* Fix incorrect message for alphanumeric validator
|
||||
* Removed incorrect false check on required attribute
|
||||
* required attribute fix for non-html5 browsers. Fixes #301
|
||||
* Added methods "require_from_group" and "skip_or_fill_minimum"
|
||||
* Use correct iso code for swedish
|
||||
* Updated demo HTML files to use HTML5 doctype
|
||||
* Fixed regex issue for decimals without leading zeroes. Added new methods test. Fixes #41
|
||||
* Introduce a elementValue method that normalizes only string values (don't touch array value of multi-select). Fixes #116
|
||||
* Support for dynamically added submit buttons, and updated test case. Uses validateDelegate. Code from PR #9
|
||||
* Fix bad double quote in test fixtures
|
||||
* Fix maxWords method to include the upper bound, not exclude it. Fixes #284
|
||||
* Fixed grammar error in german range validator message. Fixes #315
|
||||
* Fixed handling of multiple class names for errorClass option. Test by Max Lynch. Fixes #280
|
||||
* Fix jQuery.format usage, should be $.validator.format. Fixes #329
|
||||
* Methods for 'all' UK phone numbers + UK postcodes
|
||||
* Pattern method: Convert string param to RegExp. Fixes issue #223
|
||||
* grammar error in german localization file
|
||||
* Added Estonian localization for messages
|
||||
* Improve tooltip handling on themerollered demo
|
||||
* Add type="text" to input fields without type attribute to please qSA
|
||||
* Update themerollered demo to use tooltip to show errors as overlay.
|
||||
* Update themerollered demo to use latest jQuery UI (along with newer jQuery version). Move code around to speed up page load.
|
||||
* Fixed min error message broken in Japanese.
|
||||
* Update form plugin to latest version. Enhance the ajaxSubmit demo.
|
||||
* Drop dateDE and numberDE methods from classRuleSettings, leftover from moving those to localized methods
|
||||
* Passing submit event to submitHandler callback
|
||||
* Fixed #219 - Fix valid() on elements with dependency-callback or dependency-expression.
|
||||
* Improve build to remove dist dir to ensure only the current release gets zipped up
|
||||
|
||||
1.9.0
|
||||
---
|
||||
* Added Basque (EU) localization
|
||||
* Added Slovenian (SL) localization
|
||||
* Fixed issue #127 - Finnish translations has one : instead of ;
|
||||
* Fixed Russian localization, minor syntax issue
|
||||
* Added in support for HTML5 input types, fixes #97
|
||||
* Improved HTML5 support by setting novalidate attribute on the form, and reading the type attribute.
|
||||
* Fixed showLabel() removing all classes from error element. Remove only settings.validClass. Fixes #151.
|
||||
* Added 'pattern' to additional-methods to validate against arbitraty regular expressions.
|
||||
* Improved email method to not allow the dot at the end (valid by RFC, but unwanted here). Fixes #143
|
||||
* Fixed swedish and norwedian translations, min/max messages got switched. Fixes #181
|
||||
* Fixed #184 - resetForm: should unset lastElement
|
||||
* Fixed #71 - improve existing time method and add time12h method for 12h am/pm time format
|
||||
* Fixed #177 - Fix validation of a single radio or checkbox input
|
||||
* Fixed #189 - :hidden elements are now ignored by default
|
||||
* Fixed #194 - Required as attribute fails if jQuery>=1.6 - Use .prop instead of .attr
|
||||
* Fixed #47, #39, #32 - Allowed credit card numbers to contain spaces as well as dashes (spaces are commonly input by users).
|
||||
|
||||
1.8.1
|
||||
---
|
||||
* Added Thai (TH) localization, fixes #85
|
||||
* Added Vietnamese (VI) localization, thanks Ngoc
|
||||
* Fixed issue #78. Error/Valid styling applies to all radio buttons of same group for required validation.
|
||||
* Don't use form.elements as that isn't supported in jQuery 1.6 anymore. Its buggy as hell anyway (IE6-8: form.elements === form).
|
||||
|
||||
1.8.0
|
||||
---
|
||||
* Improved NL localization (http://plugins.jquery.com/node/14120)
|
||||
* Added Georgian (GE) localization, thanks Avtandil Kikabidze
|
||||
* Added Serbian (SR) localization, thanks Aleksandar Milovac
|
||||
* Added ipv4 and ipv6 to additional methods, thanks Natal Ngétal
|
||||
* Added Japanese (JA) localization, thanks Bryan Meyerovich
|
||||
* Added Catalan (CA) localization, thanks Xavier de Pedro
|
||||
* Fixed missing var statements within for-in loops
|
||||
* Fix for remote validation, where a formatted message got messed up (https://github.com/jzaefferer/jquery-validation/issues/11)
|
||||
* Bugfixes for compability with jQuery 1.5.1, while maintaining backwards-compability
|
||||
|
||||
1.7
|
||||
---
|
||||
* Added Lithuanian (LT) localization
|
||||
* Added Greek (EL) localization (http://plugins.jquery.com/node/12319)
|
||||
* Added Latvian (LV) localization (http://plugins.jquery.com/node/12349)
|
||||
* Added Hebrew (HE) localization (http://plugins.jquery.com/node/12039)
|
||||
* Fixed Spanish (ES) localization (http://plugins.jquery.com/node/12696)
|
||||
* Added jQuery UI themerolled demo
|
||||
* Removed cmxform.js
|
||||
* Fixed four missing semicolons (http://plugins.jquery.com/node/12639)
|
||||
* Renamed phone-method in additional-methods.js to phoneUS
|
||||
* Added phoneUK and mobileUK methods to additional-methods.js (http://plugins.jquery.com/node/12359)
|
||||
* Deep extend options to avoid modifying multiple forms when using the rules-method on a single element (http://plugins.jquery.com/node/12411)
|
||||
* Bugfixes for compability with jQuery 1.4.2, while maintaining backwards-compability
|
||||
|
||||
1.6
|
||||
---
|
||||
* Added Arabic (AR), Portuguese (PTPT), Persian (FA), Finnish (FI) and Bulgarian (BR) localization
|
||||
* Updated Swedish (SE) localization (some missing html iso characters)
|
||||
* Fixed $.validator.addMethod to properly handle empty string vs. undefined for the message argument
|
||||
* Fixed two accidental global variables
|
||||
* Enhanced min/max/rangeWords (in additional-methods.js) to strip html before counting; good when counting words in a richtext editor
|
||||
* Added localized methods for DE, NL and PT, removing the dateDE and numberDE methods (use messages_de.js and methods_de.js with date and number methods instead)
|
||||
* Fixed remote form submit synchronization, kudos to Matas Petrikas
|
||||
* Improved interactive select validation, now validating also on click (via option or select, inconsistent across browsers); doesn't work in Safari, which doesn't trigger a click event at all on select elements; fixes http://plugins.jquery.com/node/11520
|
||||
* Updated to latest form plugin (2.36), fixing http://plugins.jquery.com/node/11487
|
||||
* Bind to blur event for equalTo target to revalidate when that target changes, fixes http://plugins.jquery.com/node/11450
|
||||
* Simplified select validation, delegating to jQuery's val() method to get the select value; should fix http://plugins.jquery.com/node/11239
|
||||
* Fixed default message for digits (http://plugins.jquery.com/node/9853)
|
||||
* Fixed issue with cached remote message (http://plugins.jquery.com/node/11029 and http://plugins.jquery.com/node/9351)
|
||||
* Fixed a missing semicolon in additional-methods.js (http://plugins.jquery.com/node/9233)
|
||||
* Added automatic detection of substitution parameters in messages, removing the need to provide format functions (http://plugins.jquery.com/node/11195)
|
||||
* Fixed an issue with :filled/:blank somewhat caused by Sizzle (http://plugins.jquery.com/node/11144)
|
||||
* Added an integer method to additional-methods.js (http://plugins.jquery.com/node/9612)
|
||||
* Fixed errorsFor method where the for-attribute contains characters that need escaping to be valid inside a selector (http://plugins.jquery.com/node/9611)
|
||||
|
||||
1.5.5
|
||||
---
|
||||
* Fix for http://plugins.jquery.com/node/8659
|
||||
* Fixed trailing comma in messages_cs.js
|
||||
|
||||
1.5.4
|
||||
---
|
||||
* Fixed remote method bug (http://plugins.jquery.com/node/8658)
|
||||
|
||||
1.5.3
|
||||
---
|
||||
* Fixed a bug related to the wrapper-option, where all ancestor-elements that matched the wrapper-option where selected (http://plugins.jquery.com/node/7624)
|
||||
* Updated multipart demo to use latest jQuery UI accordion
|
||||
* Added dateNL and time methods to additionalMethods.js
|
||||
* Added Traditional Chinese (Taiwan, tw) and Kazakhstan (KK) localization
|
||||
* Moved jQuery.format (fomerly String.format) to jQuery.validator.format, jQuery.format is deprecated and will be removed in 1.6 (see http://code.google.com/p/jquery-utils/issues/detail?id=15 for details)
|
||||
* Cleaned up messages_pl.js and messages_ptbr.js (still defined messages for max/min/rangeValue, which were removed in 1.4)
|
||||
* Fixed flawed boolean logic in valid-plugin-method for multiple elements; now all elements need to be valid for a boolean-true result (http://plugins.jquery.com/node/8481)
|
||||
* Enhancement $.validator.addMethod: An undefined third message-argument won't overwrite an existing message (http://plugins.jquery.com/node/8443)
|
||||
* Enhancement to submitHandler option: When used, click events on submit buttons are captured and the submitting button is inserted into the form before calling submitHandler, and removed afterwards; keeps submit buttons intact (http://plugins.jquery.com/node/7183#comment-3585)
|
||||
* Added option validClass, default "valid", which adds that class to all valid elements, after validation (http://dev.jquery.com/ticket/2205)
|
||||
* Added creditcardtypes method to additionalMethods.js, including tests (via http://dev.jquery.com/ticket/3635)
|
||||
* Improved remote method to allow serverside message as a string, or true for valid, or false for invalid using the clientside defined message (http://dev.jquery.com/ticket/3807)
|
||||
* Improved accept method to also accept a Drupal-style comma-seperated list of values (http://plugins.jquery.com/node/8580)
|
||||
|
||||
1.5.2
|
||||
---
|
||||
* Fixed messages in additional-methods.js for maxWords, minWords, and rangeWords to include call to $.format
|
||||
* Fixed value passed to methods to exclude carriage return (\r), same as jQuery's val() does
|
||||
* Added slovak (sk) localization
|
||||
* Added demo for intergration with jQuery UI tabs
|
||||
* Added selects-grouping example to tabs demo (see second tab, birthdate field)
|
||||
|
||||
1.5.1
|
||||
---
|
||||
* Updated marketo demo to use invalidHandler option instead of binding invalid-form event
|
||||
* Added TinyMCE integration example
|
||||
* Added ukrainian (ua) localization
|
||||
* Fixed length validation to work with trimmed value (regression from 1.5 where general trimming before validation was removed)
|
||||
* Various small fixes for compability with both 1.2.6 and 1.3
|
||||
|
||||
1.5
|
||||
---
|
||||
* Improved basic demo, validating confirm-password field after password changed
|
||||
* Fixed basic validation to pass the untrimmed input value as the first parameter to validation methods, changed required accordingly; breaks existing custom method that rely on the trimming
|
||||
* Added norwegian (no), italian (it), hungarian (hu) and romanian (ro) localization
|
||||
* Fixed #3195: Two flaws in swedish localization
|
||||
* Fixed #3503: Extended rules("add") to accept messages propery: use to specify add custom messages to an element via rules("add", { messages: { required: "Required! " } });
|
||||
* Fixed #3356: Regression from #2908 when using meta-option
|
||||
* Fixed #3370: Added ignoreTitle option, set to skip reading messages from the title attribute, helps to avoid issues with Google Toolbar; default is false for compability
|
||||
* Fixed #3516: Trigger invalid-form event even when remote validation is involved
|
||||
* Added invalidHandler option as a shortcut to bind("invalid-form", function() {})
|
||||
* Fixed Safari issue for loading indicator in ajaxSubmit-integration-demo (append to body first, then hide)
|
||||
* Added test for creditcard validation and improved default message
|
||||
* Enhanced remote validation, accepting options to passthrough to $.ajax as paramter (either url string or options, including url property plus everything else that $.ajax supports)
|
||||
|
||||
1.4
|
||||
---
|
||||
* Fixed #2931, validate elements in document order and ignore type=image inputs
|
||||
* Fixed usage of $ and jQuery variables, now fully comptible with all variations of noConflict usage
|
||||
* Implemented #2908, enabling custom messages via metadata ala class="{required:true,messages:{required:'required field'}}", added demo/custom-messages-metadata-demo.html
|
||||
* Removed deprecated methods minValue (min), maxValue (max), rangeValue (rangevalue), minLength (minlength), maxLength (maxlength), rangeLength (rangelength)
|
||||
* Fixed #2215 regression: Call unhighlight only for current elements, not everything
|
||||
* Implemented #2989, enabling image button to cancel validation
|
||||
* Fixed issue where IE incorrectly validates against maxlength=0
|
||||
* Added czech (cs) localization
|
||||
* Reset validator.submitted on validator.resetForm(), enabling a full reset when necessary
|
||||
* Fixed #3035, skipping all falsy attributes when reading rules (0, undefined, empty string), removed part of the maxlength workaround (for 0)
|
||||
* Added dutch (nl) localization (#3201)
|
||||
|
||||
1.3
|
||||
---
|
||||
* Fixed invalid-form event, now only triggered when form is invalid
|
||||
* Added spanish (es), russian (ru), portuguese brazilian (ptbr), turkish (tr), and polish (pl) localization
|
||||
* Added removeAttrs plugin to facilate adding and removing multiple attributes
|
||||
* Added groups option to display a single message for multiple elements, via groups: { arbitraryGroupName: "fieldName1 fieldName2[, fieldNameN" }
|
||||
* Enhanced rules() for adding and removing (static) rules: rules("add", "method1[, methodN]"/{method1:param[, method_n:param]}) and rules("remove"[, "method1[, method_n]")
|
||||
* Enhanced rules-option, accepts space-seperated string-list of methods, eg. {birthdate: "required date"}
|
||||
* Fixed checkbox group validation with inline rules: As long as the rules are specified on the first element, the group is now properly validated on click
|
||||
* Fixed #2473, ignoring all rules with an explicit parameter of boolean-false, eg. required:false is the same as not specifying required at all (it was handled as required:true so far)
|
||||
* Fixed #2424, with a modified patch from #2473: Methods returning a dependency-mismatch don't stop other rules from being evaluated anymore; still, success isn't applied for optional fields
|
||||
* Fixed url and email validation to not use trimmed values
|
||||
* Fixed creditcard validation to accept only digits and dashes ("asdf" is not a valid creditcard number)
|
||||
* Allow both button and input elements for cancel buttons (via class="cancel")
|
||||
* Fixed #2215: Fixed message display to call unhighlight as part of showing and hiding messages, no more visual side-effects while checking an element and extracted validator.checkForm to validate a form without UI sideeffects
|
||||
* Rewrote custom selectors (:blank, :filled, :unchecked) with functions for compability with AIR
|
||||
|
||||
1.2.1
|
||||
-----
|
||||
|
||||
* Bundled delegeate plugin with validate plugin - its always required anyway
|
||||
* Improved remote validation to include parts from the ajaxQueue plugin for proper synchronization (no additional plugin necessary)
|
||||
* Fixed stopRequest to prevent pendingRequest < 0
|
||||
* Added jQuery.validator.autoCreateRanges property, defaults to false, enable to convert min/max to range and minlength/maxlength to rangelength; this basically fixes the issue introduced by automatically creating ranges in 1.2
|
||||
* Fixed optional-methods to not highlight anything at all if the field is blank, that is, don't trigger success
|
||||
* Allow false/null for highlight/unhighlight options instead of forcing a do-nothing-callback even when nothing needs to be highlighted
|
||||
* Fixed validate() call with no elements selected, returning undefined instead of throwing an error
|
||||
* Improved demo, replacing metadata with classes/attributes for specifying rules
|
||||
* Fixed error when no custom message is used for remote validation
|
||||
* Modified email and url validation to require domain label and top label
|
||||
* Fixed url and email validation to require TLD (actually to require domain label); 1.2 version (TLD is optional) is moved to additionals as url2 and email2
|
||||
* Fixed dynamic-totals demo in IE6/7 and improved templating, using textarea to store multiline template and string interpolation
|
||||
* Added login form example with "Email password" link that makes the password field optional
|
||||
* Enhanced dynamic-totals demo with an example of a single message for two fields
|
||||
|
||||
1.2
|
||||
---
|
||||
|
||||
* Added AJAX-captcha validation example (based on http://psyrens.com/captcha/)
|
||||
* Added remember-the-milk-demo (thanks RTM team for the permission!)
|
||||
* Added marketo-demo (thanks Glen Lipka!)
|
||||
* Added support for ajax-validation, see method "remote"; serverside returns JSON, true for valid elements, false or a String for invalid, String is used as message
|
||||
* Added highlight and unhighlight options, by default toggles errorClass on element, allows custom highlighting
|
||||
* Added valid() plugin method for easy programmatic checking of forms and fields without the need to use the validator API
|
||||
* Added rules() plguin method to read and write rules for an element (currently read only)
|
||||
* Replaced regex for email method, thanks to the contribution by Scott Gonzalez, see http://projects.scottsplayground.com/email_address_validation/
|
||||
* Restructured event architecture to rely solely on delegation, both improving performance, and ease-of-use for the developer (requires jquery.delegate.js)
|
||||
* Moved documentation from inline to http://docs.jquery.com/Plugins/Validation - including interactive examples for all methods
|
||||
* Removed validator.refresh(), validation is now completey dynamic
|
||||
* Renamed minValue to min, maxValue to max and rangeValue to range, deprecating the previous names (to be removed in 1.3)
|
||||
* Renamed minLength to minlength, maxLength to maxlength and rangeLength to rangelength, deprecating the previous names (to be removed in 1.3)
|
||||
* Added feature to merge min + max into and range and minlength + maxlength into rangelength
|
||||
* Added support for dynamic rule parameters, allowing to specify a function as a parameter eg. for minlength, called when validating the element
|
||||
* Allow to specify null or an empty string as a message to display nothing (see marketo demo)
|
||||
* Rules overhaul: Now supports combination of rules-option, metadata, classes (new) and attributes (new), see rules() for details
|
||||
|
||||
1.1.2
|
||||
---
|
||||
|
||||
* Replaced regex for URL method, thanks to the contribution by Scott Gonzalez, see http://projects.scottsplayground.com/iri/
|
||||
* Improved email method to better handle unicode characters
|
||||
* Fixed error container to hide when all elements are valid, not only on form submit
|
||||
* Fixed String.format to jQuery.format (moving into jQuery namespace)
|
||||
* Fixed accept method to accept both upper and lowercase extensions
|
||||
* Fixed validate() plugin method to create only one validator instance for a given form and always return that one instance (avoids binding events multiple times)
|
||||
* Changed debug-mode console log from "error" to "warn" level
|
||||
|
||||
1.1.1
|
||||
-----
|
||||
|
||||
* Fixed invalid XHTML, preventing error label creation in IE since jQuery 1.1.4
|
||||
* Fixed and improved String.format: Global search & replace, better handling of array arguments
|
||||
* Fixed cancel-button handling to use validator-object for storing state instead of form element
|
||||
* Fixed name selectors to handle "complex" names, eg. containing brackets ("list[]")
|
||||
* Added button and disabled elements to exclude from validation
|
||||
* Moved element event handlers to refresh to be able to add handlers to new elements
|
||||
* Fixed email validation to allow long top level domains (eg. ".travel")
|
||||
* Moved showErrors() from valid() to form()
|
||||
* Added validator.size(): returns the number of current errors
|
||||
* Call submitHandler with validator as scope for easier access of it's methods, eg. to find error labels using errorsFor(Element)
|
||||
* Compatible with jQuery 1.1.x and 1.2.x
|
||||
|
||||
1.1
|
||||
---
|
||||
|
||||
* Added validation on blur, keyup and click (for checkboxes and radiobutton). Replaces event-option.
|
||||
* Fixed resetForm
|
||||
* Fixed custom-methods-demo
|
||||
|
||||
1.0
|
||||
---
|
||||
|
||||
* Improved number and numberDE methods to check for correct decimal numbers with delimiters
|
||||
* Only elements that have rules are checked (otherwise success-option is applied to all elements)
|
||||
* Added creditcard number method (thanks to Brian Klug)
|
||||
* Added ignore-option, eg. ignore: "[@type=hidden]", using that expression to exclude elements to validate. Default: none, though submit and reset buttons are always ignored
|
||||
* Heavily enhanced Functions-as-messages by providing a flexible String.format helper
|
||||
* Accept Functions as messages, providing runtime-custom-messages
|
||||
* Fixed exclusion of elements without rules from successList
|
||||
* Fixed custom-method-demo, replaced the alert with message displaying the number of errors
|
||||
* Fixed form-submit-prevention when using submitHandler
|
||||
* Completely removed dependency on element IDs, though they are still used (when present) to link error labels to inputs. Achieved by using
|
||||
an array with {name, message, element} instead of an object with id:message pairs for the internal errorList.
|
||||
* Added support for specifying simple rules as simple strings, eg. "required" is equivalent to {required: true}
|
||||
* Added feature: Add errorClass to invalid field<6C>s parent element, making it easy to style the label/field container or the label for the field.
|
||||
* Added feature: focusCleanup - If enabled, removes the errorClass from the invalid elements and hides all errors messages whenever the element is focused.
|
||||
* Added success option to show the a field was validated successfully
|
||||
* Fixed Opera select-issue (avoiding a attribute-collision)
|
||||
* Fixed problems with focussing hidden elements in IE
|
||||
* Added feature to skip validation for submit buttons with class "cancel"
|
||||
* Fixed potential issues with Google Toolbar by prefering plugin option messages over title attribute
|
||||
* submitHandler is only called when an actual submit event was handled, validator.form() returns false only for invalid forms
|
||||
* Invalid elements are now focused only on submit or via validator.focusInvalid(), avoiding all trouble with focus-on-blur
|
||||
* IE6 error container layout issue is solved
|
||||
* Customize error element via errorElement option
|
||||
* Added validator.refresh() to find new inputs in the form
|
||||
* Added accept validation method, checks file extensions
|
||||
* Improved dependecy feature by adding two custom expressions: ":blank" to select elements with an empty value and <20>:filled<65> to select elements with a value, both excluding whitespace
|
||||
* Added a resetForm() method to the validator: Resets each form element (using the form plugin, if available), removes classes on invalid elements and hides all error messages
|
||||
* Fixed docs for validator.showErrors()
|
||||
* Fixed error label creation to always use html() instead of text(), allowing arbitrary HTML passed in as messages
|
||||
* Fixed error label creation to use specified error class
|
||||
* Added dependency feature: The requires method accepts both String (jQuery expressions) and Functions as the argument
|
||||
* Heavily improved customizing of error message display: Use normal messages and show/hide an additional container; Completely replace message display with own mechanism (while being able to delegate to the default handler; Customize placing of generated labels (instead of default below-element)
|
||||
* Fixed two major bugs in IE (error containers) and Opera (metadata)
|
||||
* Modified validation methods to accept empty fields as valid (exception: of course <20>required<65> and also <20>equalTo<54> methods)
|
||||
* Renamed "min" to "minLength", "max" to "maxLength", "length" to "rangeLength"
|
||||
* Added "minValue", "maxValue" and "rangeValue"
|
||||
* Streamlined API for support of different events. The default, submit, can be disabled. If any event is specified, that is applied to each element (instead of the entire form). Combining keyup-validation with submit-validation is now extremely easy to setup
|
||||
* Added support for one-message-per-rule when defining messages via plugin settings
|
||||
* Added support to wrap metadata in some parent element. Useful when metadata is used for other plugins, too.
|
||||
* Refactored tests and demos: Less files, better demos
|
||||
* Improved documentation: More examples for methods, more reference texts explaining some basics
|
||||
617
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/dist/additional-methods.js
vendored
Normal file
617
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/dist/additional-methods.js
vendored
Normal file
@@ -0,0 +1,617 @@
|
||||
/*!
|
||||
* jQuery Validation Plugin 1.11.1
|
||||
*
|
||||
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
|
||||
* http://docs.jquery.com/Plugins/Validation
|
||||
*
|
||||
* Copyright 2013 Jörn Zaefferer
|
||||
* Released under the MIT license:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
function stripHtml(value) {
|
||||
// remove html tags and space chars
|
||||
return value.replace(/<.[^<>]*?>/g, ' ').replace(/ | /gi, ' ')
|
||||
// remove punctuation
|
||||
.replace(/[.(),;:!?%#$'"_+=\/\-]*/g,'');
|
||||
}
|
||||
jQuery.validator.addMethod("maxWords", function(value, element, params) {
|
||||
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length <= params;
|
||||
}, jQuery.validator.format("Please enter {0} words or less."));
|
||||
|
||||
jQuery.validator.addMethod("minWords", function(value, element, params) {
|
||||
return this.optional(element) || stripHtml(value).match(/\b\w+\b/g).length >= params;
|
||||
}, jQuery.validator.format("Please enter at least {0} words."));
|
||||
|
||||
jQuery.validator.addMethod("rangeWords", function(value, element, params) {
|
||||
var valueStripped = stripHtml(value);
|
||||
var regex = /\b\w+\b/g;
|
||||
return this.optional(element) || valueStripped.match(regex).length >= params[0] && valueStripped.match(regex).length <= params[1];
|
||||
}, jQuery.validator.format("Please enter between {0} and {1} words."));
|
||||
|
||||
}());
|
||||
|
||||
jQuery.validator.addMethod("letterswithbasicpunc", function(value, element) {
|
||||
return this.optional(element) || /^[a-z\-.,()'"\s]+$/i.test(value);
|
||||
}, "Letters or punctuation only please");
|
||||
|
||||
jQuery.validator.addMethod("alphanumeric", function(value, element) {
|
||||
return this.optional(element) || /^\w+$/i.test(value);
|
||||
}, "Letters, numbers, and underscores only please");
|
||||
|
||||
jQuery.validator.addMethod("lettersonly", function(value, element) {
|
||||
return this.optional(element) || /^[a-z]+$/i.test(value);
|
||||
}, "Letters only please");
|
||||
|
||||
jQuery.validator.addMethod("nowhitespace", function(value, element) {
|
||||
return this.optional(element) || /^\S+$/i.test(value);
|
||||
}, "No white space please");
|
||||
|
||||
jQuery.validator.addMethod("ziprange", function(value, element) {
|
||||
return this.optional(element) || /^90[2-5]\d\{2\}-\d{4}$/.test(value);
|
||||
}, "Your ZIP-code must be in the range 902xx-xxxx to 905-xx-xxxx");
|
||||
|
||||
jQuery.validator.addMethod("zipcodeUS", function(value, element) {
|
||||
return this.optional(element) || /\d{5}-\d{4}$|^\d{5}$/.test(value);
|
||||
}, "The specified US ZIP Code is invalid");
|
||||
|
||||
jQuery.validator.addMethod("integer", function(value, element) {
|
||||
return this.optional(element) || /^-?\d+$/.test(value);
|
||||
}, "A positive or negative non-decimal number please");
|
||||
|
||||
/**
|
||||
* Return true, if the value is a valid vehicle identification number (VIN).
|
||||
*
|
||||
* Works with all kind of text inputs.
|
||||
*
|
||||
* @example <input type="text" size="20" name="VehicleID" class="{required:true,vinUS:true}" />
|
||||
* @desc Declares a required input element whose value must be a valid vehicle identification number.
|
||||
*
|
||||
* @name jQuery.validator.methods.vinUS
|
||||
* @type Boolean
|
||||
* @cat Plugins/Validate/Methods
|
||||
*/
|
||||
jQuery.validator.addMethod("vinUS", function(v) {
|
||||
if (v.length !== 17) {
|
||||
return false;
|
||||
}
|
||||
var i, n, d, f, cd, cdv;
|
||||
var LL = ["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"];
|
||||
var VL = [1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9];
|
||||
var FL = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2];
|
||||
var rs = 0;
|
||||
for(i = 0; i < 17; i++){
|
||||
f = FL[i];
|
||||
d = v.slice(i,i+1);
|
||||
if (i === 8) {
|
||||
cdv = d;
|
||||
}
|
||||
if (!isNaN(d)) {
|
||||
d *= f;
|
||||
} else {
|
||||
for (n = 0; n < LL.length; n++) {
|
||||
if (d.toUpperCase() === LL[n]) {
|
||||
d = VL[n];
|
||||
d *= f;
|
||||
if (isNaN(cdv) && n === 8) {
|
||||
cdv = LL[n];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
rs += d;
|
||||
}
|
||||
cd = rs % 11;
|
||||
if (cd === 10) {
|
||||
cd = "X";
|
||||
}
|
||||
if (cd === cdv) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, "The specified vehicle identification number (VIN) is invalid.");
|
||||
|
||||
/**
|
||||
* Return true, if the value is a valid date, also making this formal check dd/mm/yyyy.
|
||||
*
|
||||
* @example jQuery.validator.methods.date("01/01/1900")
|
||||
* @result true
|
||||
*
|
||||
* @example jQuery.validator.methods.date("01/13/1990")
|
||||
* @result false
|
||||
*
|
||||
* @example jQuery.validator.methods.date("01.01.1900")
|
||||
* @result false
|
||||
*
|
||||
* @example <input name="pippo" class="{dateITA:true}" />
|
||||
* @desc Declares an optional input element whose value must be a valid date.
|
||||
*
|
||||
* @name jQuery.validator.methods.dateITA
|
||||
* @type Boolean
|
||||
* @cat Plugins/Validate/Methods
|
||||
*/
|
||||
jQuery.validator.addMethod("dateITA", function(value, element) {
|
||||
var check = false;
|
||||
var re = /^\d{1,2}\/\d{1,2}\/\d{4}$/;
|
||||
if( re.test(value)) {
|
||||
var adata = value.split('/');
|
||||
var gg = parseInt(adata[0],10);
|
||||
var mm = parseInt(adata[1],10);
|
||||
var aaaa = parseInt(adata[2],10);
|
||||
var xdata = new Date(aaaa,mm-1,gg);
|
||||
if ( ( xdata.getFullYear() === aaaa ) && ( xdata.getMonth() === mm - 1 ) && ( xdata.getDate() === gg ) ){
|
||||
check = true;
|
||||
} else {
|
||||
check = false;
|
||||
}
|
||||
} else {
|
||||
check = false;
|
||||
}
|
||||
return this.optional(element) || check;
|
||||
}, "Please enter a correct date");
|
||||
|
||||
/**
|
||||
* IBAN is the international bank account number.
|
||||
* It has a country - specific format, that is checked here too
|
||||
*/
|
||||
jQuery.validator.addMethod("iban", function(value, element) {
|
||||
// some quick simple tests to prevent needless work
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
if (!(/^([a-zA-Z0-9]{4} ){2,8}[a-zA-Z0-9]{1,4}|[a-zA-Z0-9]{12,34}$/.test(value))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// check the country code and find the country specific format
|
||||
var iban = value.replace(/ /g,'').toUpperCase(); // remove spaces and to upper case
|
||||
var countrycode = iban.substring(0,2);
|
||||
var bbancountrypatterns = {
|
||||
'AL': "\\d{8}[\\dA-Z]{16}",
|
||||
'AD': "\\d{8}[\\dA-Z]{12}",
|
||||
'AT': "\\d{16}",
|
||||
'AZ': "[\\dA-Z]{4}\\d{20}",
|
||||
'BE': "\\d{12}",
|
||||
'BH': "[A-Z]{4}[\\dA-Z]{14}",
|
||||
'BA': "\\d{16}",
|
||||
'BR': "\\d{23}[A-Z][\\dA-Z]",
|
||||
'BG': "[A-Z]{4}\\d{6}[\\dA-Z]{8}",
|
||||
'CR': "\\d{17}",
|
||||
'HR': "\\d{17}",
|
||||
'CY': "\\d{8}[\\dA-Z]{16}",
|
||||
'CZ': "\\d{20}",
|
||||
'DK': "\\d{14}",
|
||||
'DO': "[A-Z]{4}\\d{20}",
|
||||
'EE': "\\d{16}",
|
||||
'FO': "\\d{14}",
|
||||
'FI': "\\d{14}",
|
||||
'FR': "\\d{10}[\\dA-Z]{11}\\d{2}",
|
||||
'GE': "[\\dA-Z]{2}\\d{16}",
|
||||
'DE': "\\d{18}",
|
||||
'GI': "[A-Z]{4}[\\dA-Z]{15}",
|
||||
'GR': "\\d{7}[\\dA-Z]{16}",
|
||||
'GL': "\\d{14}",
|
||||
'GT': "[\\dA-Z]{4}[\\dA-Z]{20}",
|
||||
'HU': "\\d{24}",
|
||||
'IS': "\\d{22}",
|
||||
'IE': "[\\dA-Z]{4}\\d{14}",
|
||||
'IL': "\\d{19}",
|
||||
'IT': "[A-Z]\\d{10}[\\dA-Z]{12}",
|
||||
'KZ': "\\d{3}[\\dA-Z]{13}",
|
||||
'KW': "[A-Z]{4}[\\dA-Z]{22}",
|
||||
'LV': "[A-Z]{4}[\\dA-Z]{13}",
|
||||
'LB': "\\d{4}[\\dA-Z]{20}",
|
||||
'LI': "\\d{5}[\\dA-Z]{12}",
|
||||
'LT': "\\d{16}",
|
||||
'LU': "\\d{3}[\\dA-Z]{13}",
|
||||
'MK': "\\d{3}[\\dA-Z]{10}\\d{2}",
|
||||
'MT': "[A-Z]{4}\\d{5}[\\dA-Z]{18}",
|
||||
'MR': "\\d{23}",
|
||||
'MU': "[A-Z]{4}\\d{19}[A-Z]{3}",
|
||||
'MC': "\\d{10}[\\dA-Z]{11}\\d{2}",
|
||||
'MD': "[\\dA-Z]{2}\\d{18}",
|
||||
'ME': "\\d{18}",
|
||||
'NL': "[A-Z]{4}\\d{10}",
|
||||
'NO': "\\d{11}",
|
||||
'PK': "[\\dA-Z]{4}\\d{16}",
|
||||
'PS': "[\\dA-Z]{4}\\d{21}",
|
||||
'PL': "\\d{24}",
|
||||
'PT': "\\d{21}",
|
||||
'RO': "[A-Z]{4}[\\dA-Z]{16}",
|
||||
'SM': "[A-Z]\\d{10}[\\dA-Z]{12}",
|
||||
'SA': "\\d{2}[\\dA-Z]{18}",
|
||||
'RS': "\\d{18}",
|
||||
'SK': "\\d{20}",
|
||||
'SI': "\\d{15}",
|
||||
'ES': "\\d{20}",
|
||||
'SE': "\\d{20}",
|
||||
'CH': "\\d{5}[\\dA-Z]{12}",
|
||||
'TN': "\\d{20}",
|
||||
'TR': "\\d{5}[\\dA-Z]{17}",
|
||||
'AE': "\\d{3}\\d{16}",
|
||||
'GB': "[A-Z]{4}\\d{14}",
|
||||
'VG': "[\\dA-Z]{4}\\d{16}"
|
||||
};
|
||||
var bbanpattern = bbancountrypatterns[countrycode];
|
||||
// As new countries will start using IBAN in the
|
||||
// future, we only check if the countrycode is known.
|
||||
// This prevents false negatives, while almost all
|
||||
// false positives introduced by this, will be caught
|
||||
// by the checksum validation below anyway.
|
||||
// Strict checking should return FALSE for unknown
|
||||
// countries.
|
||||
if (typeof bbanpattern !== 'undefined') {
|
||||
var ibanregexp = new RegExp("^[A-Z]{2}\\d{2}" + bbanpattern + "$", "");
|
||||
if (!(ibanregexp.test(iban))) {
|
||||
return false; // invalid country specific format
|
||||
}
|
||||
}
|
||||
|
||||
// now check the checksum, first convert to digits
|
||||
var ibancheck = iban.substring(4,iban.length) + iban.substring(0,4);
|
||||
var ibancheckdigits = "";
|
||||
var leadingZeroes = true;
|
||||
var charAt;
|
||||
for (var i =0; i<ibancheck.length; i++) {
|
||||
charAt = ibancheck.charAt(i);
|
||||
if (charAt !== "0") {
|
||||
leadingZeroes = false;
|
||||
}
|
||||
if (!leadingZeroes) {
|
||||
ibancheckdigits += "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(charAt);
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the result of: ibancheckdigits % 97
|
||||
var cRest = '';
|
||||
var cOperator = '';
|
||||
for (var p=0; p<ibancheckdigits.length; p++) {
|
||||
var cChar = ibancheckdigits.charAt(p);
|
||||
cOperator = '' + cRest + '' + cChar;
|
||||
cRest = cOperator % 97;
|
||||
}
|
||||
return cRest === 1;
|
||||
}, "Please specify a valid IBAN");
|
||||
|
||||
jQuery.validator.addMethod("dateNL", function(value, element) {
|
||||
return this.optional(element) || /^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(value);
|
||||
}, "Please enter a correct date");
|
||||
|
||||
/**
|
||||
* Dutch phone numbers have 10 digits (or 11 and start with +31).
|
||||
*/
|
||||
jQuery.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);
|
||||
}, "Please specify a valid phone number.");
|
||||
|
||||
jQuery.validator.addMethod("mobileNL", function(value, element) {
|
||||
return this.optional(element) || /^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(value);
|
||||
}, "Please specify a valid mobile number");
|
||||
|
||||
jQuery.validator.addMethod("postalcodeNL", function(value, element) {
|
||||
return this.optional(element) || /^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(value);
|
||||
}, "Please specify a valid postal code");
|
||||
|
||||
/*
|
||||
* Dutch bank account numbers (not 'giro' numbers) have 9 digits
|
||||
* and pass the '11 check'.
|
||||
* We accept the notation with spaces, as that is common.
|
||||
* acceptable: 123456789 or 12 34 56 789
|
||||
*/
|
||||
jQuery.validator.addMethod("bankaccountNL", function(value, element) {
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
if (!(/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(value))) {
|
||||
return false;
|
||||
}
|
||||
// now '11 check'
|
||||
var account = value.replace(/ /g,''); // remove spaces
|
||||
var sum = 0;
|
||||
var len = account.length;
|
||||
for (var pos=0; pos<len; pos++) {
|
||||
var factor = len - pos;
|
||||
var digit = account.substring(pos, pos+1);
|
||||
sum = sum + factor * digit;
|
||||
}
|
||||
return sum % 11 === 0;
|
||||
}, "Please specify a valid bank account number");
|
||||
|
||||
/**
|
||||
* Dutch giro account numbers (not bank numbers) have max 7 digits
|
||||
*/
|
||||
jQuery.validator.addMethod("giroaccountNL", function(value, element) {
|
||||
return this.optional(element) || /^[0-9]{1,7}$/.test(value);
|
||||
}, "Please specify a valid giro account number");
|
||||
|
||||
jQuery.validator.addMethod("bankorgiroaccountNL", function(value, element) {
|
||||
return this.optional(element) ||
|
||||
($.validator.methods["bankaccountNL"].call(this, value, element)) ||
|
||||
($.validator.methods["giroaccountNL"].call(this, value, element));
|
||||
}, "Please specify a valid bank or giro account number");
|
||||
|
||||
|
||||
jQuery.validator.addMethod("time", function(value, element) {
|
||||
return this.optional(element) || /^([01]\d|2[0-3])(:[0-5]\d){1,2}$/.test(value);
|
||||
}, "Please enter a valid time, between 00:00 and 23:59");
|
||||
jQuery.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);
|
||||
}, "Please enter a valid time in 12-hour am/pm format");
|
||||
|
||||
/**
|
||||
* matches US phone number format
|
||||
*
|
||||
* 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
|
||||
* some people may want to put a '1' in front of their number
|
||||
*
|
||||
* 1(212)-999-2345 or
|
||||
* 212 999 2344 or
|
||||
* 212-999-0983
|
||||
*
|
||||
* but not
|
||||
* 111-123-5434
|
||||
* and not
|
||||
* 212 123 4567
|
||||
*/
|
||||
jQuery.validator.addMethod("phoneUS", function(phone_number, element) {
|
||||
phone_number = phone_number.replace(/\s+/g, "");
|
||||
return this.optional(element) || phone_number.length > 9 &&
|
||||
phone_number.match(/^(\+?1-?)?(\([2-9]\d{2}\)|[2-9]\d{2})-?[2-9]\d{2}-?\d{4}$/);
|
||||
}, "Please specify a valid phone number");
|
||||
|
||||
jQuery.validator.addMethod('phoneUK', 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))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/);
|
||||
}, 'Please specify a valid phone number');
|
||||
|
||||
jQuery.validator.addMethod('mobileUK', 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)7(?:[45789]\d{2}|624)\s?\d{3}\s?\d{3})$/);
|
||||
}, 'Please specify a valid mobile number');
|
||||
|
||||
//Matches UK landline + mobile, accepting only 01-3 for landline or 07 for mobile to exclude many premium numbers
|
||||
jQuery.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(?:[45789]\d{8}|624\d{6})))$/);
|
||||
}, 'Please specify a valid uk phone number');
|
||||
// On the above three UK 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 postcode. Does not match to UK Channel Islands that have their own postcodes (non standard UK)
|
||||
jQuery.validator.addMethod('postcodeUK', function(value, element) {
|
||||
return this.optional(element) || /^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(value);
|
||||
}, 'Please specify a valid UK postcode');
|
||||
|
||||
// TODO check if value starts with <, otherwise don't try stripping anything
|
||||
jQuery.validator.addMethod("strippedminlength", function(value, element, param) {
|
||||
return jQuery(value).text().length >= param;
|
||||
}, jQuery.validator.format("Please enter at least {0} characters"));
|
||||
|
||||
// same as email, but TLD is optional
|
||||
jQuery.validator.addMethod("email2", function(value, element, param) {
|
||||
return this.optional(element) || /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([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])))\.?$/i.test(value);
|
||||
}, jQuery.validator.messages.email);
|
||||
|
||||
// same as url, but TLD is optional
|
||||
jQuery.validator.addMethod("url2", function(value, element, param) {
|
||||
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);
|
||||
}, jQuery.validator.messages.url);
|
||||
|
||||
// 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
|
||||
// Valid Types: mastercard, visa, amex, dinersclub, enroute, discover, jcb, unknown, all (overrides all other settings)
|
||||
jQuery.validator.addMethod("creditcardtypes", function(value, element, param) {
|
||||
if (/[^0-9\-]+/.test(value)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
value = value.replace(/\D/g, "");
|
||||
|
||||
var validTypes = 0x0000;
|
||||
|
||||
if (param.mastercard) {
|
||||
validTypes |= 0x0001;
|
||||
}
|
||||
if (param.visa) {
|
||||
validTypes |= 0x0002;
|
||||
}
|
||||
if (param.amex) {
|
||||
validTypes |= 0x0004;
|
||||
}
|
||||
if (param.dinersclub) {
|
||||
validTypes |= 0x0008;
|
||||
}
|
||||
if (param.enroute) {
|
||||
validTypes |= 0x0010;
|
||||
}
|
||||
if (param.discover) {
|
||||
validTypes |= 0x0020;
|
||||
}
|
||||
if (param.jcb) {
|
||||
validTypes |= 0x0040;
|
||||
}
|
||||
if (param.unknown) {
|
||||
validTypes |= 0x0080;
|
||||
}
|
||||
if (param.all) {
|
||||
validTypes = 0x0001 | 0x0002 | 0x0004 | 0x0008 | 0x0010 | 0x0020 | 0x0040 | 0x0080;
|
||||
}
|
||||
if (validTypes & 0x0001 && /^(5[12345])/.test(value)) { //mastercard
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0002 && /^(4)/.test(value)) { //visa
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0004 && /^(3[47])/.test(value)) { //amex
|
||||
return value.length === 15;
|
||||
}
|
||||
if (validTypes & 0x0008 && /^(3(0[012345]|[68]))/.test(value)) { //dinersclub
|
||||
return value.length === 14;
|
||||
}
|
||||
if (validTypes & 0x0010 && /^(2(014|149))/.test(value)) { //enroute
|
||||
return value.length === 15;
|
||||
}
|
||||
if (validTypes & 0x0020 && /^(6011)/.test(value)) { //discover
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0040 && /^(3)/.test(value)) { //jcb
|
||||
return value.length === 16;
|
||||
}
|
||||
if (validTypes & 0x0040 && /^(2131|1800)/.test(value)) { //jcb
|
||||
return value.length === 15;
|
||||
}
|
||||
if (validTypes & 0x0080) { //unknown
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}, "Please enter a valid credit card number.");
|
||||
|
||||
jQuery.validator.addMethod("ipv4", function(value, element, param) {
|
||||
return this.optional(element) || /^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(value);
|
||||
}, "Please enter a valid IP v4 address.");
|
||||
|
||||
jQuery.validator.addMethod("ipv6", function(value, element, param) {
|
||||
return this.optional(element) || /^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(value);
|
||||
}, "Please enter a valid IP v6 address.");
|
||||
|
||||
/**
|
||||
* Return true if the field value matches the given format RegExp
|
||||
*
|
||||
* @example jQuery.validator.methods.pattern("AR1004",element,/^AR\d{4}$/)
|
||||
* @result true
|
||||
*
|
||||
* @example jQuery.validator.methods.pattern("BR1004",element,/^AR\d{4}$/)
|
||||
* @result false
|
||||
*
|
||||
* @name jQuery.validator.methods.pattern
|
||||
* @type Boolean
|
||||
* @cat Plugins/Validate/Methods
|
||||
*/
|
||||
jQuery.validator.addMethod("pattern", function(value, element, param) {
|
||||
if (this.optional(element)) {
|
||||
return true;
|
||||
}
|
||||
if (typeof param === 'string') {
|
||||
param = new RegExp('^(?:' + param + ')$');
|
||||
}
|
||||
return param.test(value);
|
||||
}, "Invalid format.");
|
||||
|
||||
|
||||
/*
|
||||
* Lets you say "at least X inputs that match selector Y must be filled."
|
||||
*
|
||||
* The end result is that neither of these inputs:
|
||||
*
|
||||
* <input class="productinfo" name="partnumber">
|
||||
* <input class="productinfo" name="description">
|
||||
*
|
||||
* ...will validate unless at least one of them is filled.
|
||||
*
|
||||
* partnumber: {require_from_group: [1,".productinfo"]},
|
||||
* description: {require_from_group: [1,".productinfo"]}
|
||||
*
|
||||
*/
|
||||
jQuery.validator.addMethod("require_from_group", function(value, element, options) {
|
||||
var validator = this;
|
||||
var selector = options[1];
|
||||
var validOrNot = $(selector, element.form).filter(function() {
|
||||
return validator.elementValue(this);
|
||||
}).length >= options[0];
|
||||
|
||||
if(!$(element).data('being_validated')) {
|
||||
var fields = $(selector, element.form);
|
||||
fields.data('being_validated', true);
|
||||
fields.valid();
|
||||
fields.data('being_validated', false);
|
||||
}
|
||||
return validOrNot;
|
||||
}, jQuery.format("Please fill at least {0} of these fields."));
|
||||
|
||||
/*
|
||||
* Lets you say "either at least X inputs that match selector Y must be filled,
|
||||
* OR they must all be skipped (left blank)."
|
||||
*
|
||||
* The end result, is that none of these inputs:
|
||||
*
|
||||
* <input class="productinfo" name="partnumber">
|
||||
* <input class="productinfo" name="description">
|
||||
* <input class="productinfo" name="color">
|
||||
*
|
||||
* ...will validate unless either at least two of them are filled,
|
||||
* OR none of them are.
|
||||
*
|
||||
* partnumber: {skip_or_fill_minimum: [2,".productinfo"]},
|
||||
* description: {skip_or_fill_minimum: [2,".productinfo"]},
|
||||
* color: {skip_or_fill_minimum: [2,".productinfo"]}
|
||||
*
|
||||
*/
|
||||
jQuery.validator.addMethod("skip_or_fill_minimum", function(value, element, options) {
|
||||
var validator = this,
|
||||
numberRequired = options[0],
|
||||
selector = options[1];
|
||||
var numberFilled = $(selector, element.form).filter(function() {
|
||||
return validator.elementValue(this);
|
||||
}).length;
|
||||
var valid = numberFilled >= numberRequired || numberFilled === 0;
|
||||
|
||||
if(!$(element).data('being_validated')) {
|
||||
var fields = $(selector, element.form);
|
||||
fields.data('being_validated', true);
|
||||
fields.valid();
|
||||
fields.data('being_validated', false);
|
||||
}
|
||||
return valid;
|
||||
}, jQuery.format("Please either skip these fields or fill at least {0} of them."));
|
||||
|
||||
// Accept a value from a file input based on a required mimetype
|
||||
jQuery.validator.addMethod("accept", function(value, element, param) {
|
||||
// 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/*",
|
||||
optionalValue = this.optional(element),
|
||||
i, file;
|
||||
|
||||
// Element is optional
|
||||
if (optionalValue) {
|
||||
return optionalValue;
|
||||
}
|
||||
|
||||
if ($(element).attr("type") === "file") {
|
||||
// If we are using a wildcard, make it regex friendly
|
||||
typeParam = typeParam.replace(/\*/g, ".*");
|
||||
|
||||
// Check if the element has a FileList before checking each file
|
||||
if (element.files && element.files.length) {
|
||||
for (i = 0; i < element.files.length; i++) {
|
||||
file = element.files[i];
|
||||
|
||||
// Grab the mimetype from the loaded file, verify it matches
|
||||
if (!file.type.match(new RegExp( ".?(" + typeParam + ")$", "i"))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Either return true because we've validated each file, or because the
|
||||
// browser does not support element.files and the FileList feature
|
||||
return true;
|
||||
}, jQuery.format("Please enter a value with a valid mimetype."));
|
||||
|
||||
// Older "accept" file extension method. Old docs: http://docs.jquery.com/Plugins/Validation/Methods/accept
|
||||
jQuery.validator.addMethod("extension", function(value, element, param) {
|
||||
param = typeof param === "string" ? param.replace(/,/g, '|') : "png|jpe?g|gif";
|
||||
return this.optional(element) || value.match(new RegExp(".(" + param + ")$", "i"));
|
||||
}, jQuery.format("Please enter a value with a valid extension."));
|
||||
File diff suppressed because one or more lines are too long
1231
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/dist/jquery.validate.js
vendored
Normal file
1231
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/dist/jquery.validate.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
2
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/dist/jquery.validate.min.js
vendored
Normal file
2
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/dist/jquery.validate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -0,0 +1,121 @@
|
||||
/*global config:true, task:true*/
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
pkg: '<json:package.json>',
|
||||
meta: {
|
||||
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
|
||||
'<%= grunt.template.today("m/d/yyyy") %>\n' +
|
||||
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
|
||||
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
|
||||
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
|
||||
},
|
||||
concat: {
|
||||
'dist/jquery.validate.js': ['<banner>', '<file_strip_banner:jquery.validate.js>'],
|
||||
'dist/additional-methods.js': ['<banner>', '<file_strip_banner:additional-methods.js>']
|
||||
},
|
||||
min: {
|
||||
'dist/jquery.validate.min.js': ['<banner>', 'dist/jquery.validate.js'],
|
||||
'dist/additional-methods.min.js': ['<banner>', 'dist/additional-methods.js']
|
||||
},
|
||||
zip: {
|
||||
dist: {
|
||||
src: [
|
||||
'dist/additional-methods.js',
|
||||
'dist/additional-methods.min.js',
|
||||
'dist/jquery.validate.js',
|
||||
'dist/jquery.validate.min.js',
|
||||
'README.md',
|
||||
'changelog.txt',
|
||||
'grunt.js',
|
||||
'package.json',
|
||||
'demo/**/*.*',
|
||||
'lib/**/*.*',
|
||||
'localization/**/*.*',
|
||||
'test/**/*.*'
|
||||
],
|
||||
dest: 'dist/<%= pkg.name %>-<%= pkg.version %>.zip'
|
||||
}
|
||||
},
|
||||
qunit: {
|
||||
files: ['test/index.html']
|
||||
},
|
||||
lint: {
|
||||
files: [
|
||||
'jquery.validate.js',
|
||||
'additional-methods.js',
|
||||
'localization/*.js'
|
||||
],
|
||||
test: [
|
||||
'test/test.js',
|
||||
'test/rules.js',
|
||||
'test/messages.js',
|
||||
'test/methods.js'
|
||||
]
|
||||
},
|
||||
jshint: {
|
||||
options: {
|
||||
curly: true,
|
||||
eqeqeq: true,
|
||||
immed: true,
|
||||
latedef: true,
|
||||
newcap: true,
|
||||
noarg: true,
|
||||
sub: true,
|
||||
undef: true,
|
||||
eqnull: true,
|
||||
browser: true
|
||||
},
|
||||
globals: {
|
||||
jQuery: true,
|
||||
$: true,
|
||||
console: true,
|
||||
/* TODO only allows these for tests (grunt 0.4) */
|
||||
QUnit: true,
|
||||
module: true,
|
||||
test: true,
|
||||
start: true,
|
||||
stop: true,
|
||||
expect: true,
|
||||
ok: true,
|
||||
equal: true,
|
||||
deepEqual: true,
|
||||
strictEqual: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
grunt.registerMultiTask('zip', 'Create a zip file for release', function() {
|
||||
var files = grunt.file.expand(this.file.src);
|
||||
// grunt.log.writeln(require('util').inspect(files));
|
||||
grunt.log.writeln("Creating zip file " + this.file.dest);
|
||||
|
||||
var done = this.async();
|
||||
|
||||
var zipstream = require('zipstream');
|
||||
var fs = require('fs');
|
||||
|
||||
var out = fs.createWriteStream(this.file.dest);
|
||||
var zip = zipstream.createZip({ level: 1 });
|
||||
|
||||
zip.pipe(out);
|
||||
|
||||
function addFile() {
|
||||
if (!files.length) {
|
||||
zip.finalize(function(written) {
|
||||
grunt.log.writeln(written + ' total bytes written');
|
||||
done();
|
||||
});
|
||||
return;
|
||||
}
|
||||
var file = files.shift();
|
||||
grunt.log.verbose.writeln('Zipping ' + file);
|
||||
zip.addFile(fs.createReadStream(file), { name: file }, addFile);
|
||||
}
|
||||
addFile();
|
||||
});
|
||||
|
||||
grunt.registerTask('default', 'lint qunit');
|
||||
grunt.registerTask('release', 'default concat min zip');
|
||||
|
||||
};
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 223 B |
@@ -0,0 +1,8 @@
|
||||
label.error {
|
||||
background:url("images/unchecked.gif") no-repeat 0px 0px;
|
||||
padding-left: 18px;
|
||||
padding-bottom: 2px;
|
||||
font-weight: bold;
|
||||
color: #EA5200;
|
||||
margin-left: 10px;
|
||||
}
|
||||
1231
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/jquery.validate.js
vendored
Normal file
1231
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/jquery.validate.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: ZH (Chinese, 中文 (Zhōngwén), 汉语, 漢語)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "必填信息",
|
||||
remote: "请修正该信息",
|
||||
email: "请输入正确格式的电子邮件",
|
||||
url: "请输入合法的网址",
|
||||
date: "请输入合法的日期",
|
||||
dateISO: "请输入合法的日期 (ISO).",
|
||||
number: "请输入合法的数字",
|
||||
digits: "只能输入整数",
|
||||
creditcard: "请输入合法的信用卡号",
|
||||
equalTo: "请再次输入相同的值",
|
||||
accept: "请输入拥有合法后缀名的字符串",
|
||||
maxlength: $.validator.format("请输入一个长度最多是 {0} 的字符串"),
|
||||
minlength: $.validator.format("请输入一个长度最少是 {0} 的字符串"),
|
||||
rangelength: $.validator.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"),
|
||||
range: $.validator.format("请输入一个介于 {0} 和 {1} 之间的值"),
|
||||
max: $.validator.format("请输入一个最大为 {0} 的值"),
|
||||
min: $.validator.format("请输入一个最小为 {0} 的值")
|
||||
});
|
||||
}(jQuery));
|
||||
|
||||
jQuery.validator.addMethod("ip", function(value, element) {
|
||||
return this.optional(element) || (/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(value) && (RegExp.$1 <256 && RegExp.$2<256 && RegExp.$3<256 && RegExp.$4<256));
|
||||
}, "请输入合法的IP地址");
|
||||
|
||||
jQuery.validator.addMethod("abc",function(value, element) {
|
||||
return this.optional(element) || /^[a-zA-Z0-9_]*$/.test(value);
|
||||
},"请输入字母数字或下划线");
|
||||
|
||||
jQuery.validator.addMethod("username",function(value, element) {
|
||||
return this.optional(element) || /^[a-zA-Z0-9][a-zA-Z0-9_]{2,19}$/.test(value);
|
||||
},"3-20位字母或数字开头,允许字母数字下划线");
|
||||
|
||||
jQuery.validator.addMethod("noEqualTo",function(value, element, param) {
|
||||
return value != $(param).val();
|
||||
},"请再次输入不同的值");
|
||||
|
||||
jQuery.validator.addMethod("gt",function(value, element, param) {
|
||||
return value > $(param).val();
|
||||
},"请输入更大的值");
|
||||
|
||||
jQuery.validator.addMethod("lt",function(value, element, param) {
|
||||
return value < $(param).val();
|
||||
},"请输入更小的值");
|
||||
|
||||
//真实姓名验证
|
||||
jQuery.validator.addMethod("realName", function(value, element) {
|
||||
return this.optional(element) || /^[\u4e00-\u9fa5]{2,30}$/.test(value);
|
||||
}, "姓名只能为2-30个汉字");
|
||||
|
||||
// 字符验证
|
||||
jQuery.validator.addMethod("userName", function(value, element) {
|
||||
return this.optional(element) || /^[\u0391-\uFFE5\w]+$/.test(value);
|
||||
}, "登录名只能包括中文字、英文字母、数字和下划线");
|
||||
|
||||
// 手机号码验证
|
||||
jQuery.validator.addMethod("mobile", function(value, element) {
|
||||
var length = value.length;
|
||||
return this.optional(element) || (length == 11 && /^(((13[0-9]{1})|(15[0-9]{1}))+\d{8})$/.test(value));
|
||||
}, "请正确填写您的手机号码");
|
||||
|
||||
// 电话号码验证
|
||||
jQuery.validator.addMethod("simplePhone", function(value, element) {
|
||||
var tel = /^(\d{3,4}-?)?\d{7,9}$/g;
|
||||
return this.optional(element) || (tel.test(value));
|
||||
}, "请正确填写您的电话号码");
|
||||
|
||||
// 电话号码验证
|
||||
jQuery.validator.addMethod("phone", function(value, element) {
|
||||
var tel = /(^0[1-9]{1}\d{9,10}$)|(^1[3,5,8]\d{9}$)/g;
|
||||
return this.optional(element) || (tel.test(value));
|
||||
}, "格式为:固话为区号(3-4位)号码(7-9位),手机为:13,15,18号段");
|
||||
|
||||
// 邮政编码验证
|
||||
jQuery.validator.addMethod("zipCode", function(value, element) {
|
||||
var tel = /^[0-9]{6}$/;
|
||||
return this.optional(element) || (tel.test(value));
|
||||
}, "请正确填写您的邮政编码");
|
||||
|
||||
//QQ号码验证
|
||||
jQuery.validator.addMethod("qq", function(value, element) {
|
||||
var tel = /^[1-9][0-9]{4,}$/;
|
||||
return this.optional(element) || (tel.test(value));
|
||||
}, "请正确填写您的QQ号码");
|
||||
|
||||
//校验身份证好
|
||||
jQuery.validator.addMethod("card",function(value, element) {
|
||||
return this.optional(element) || checkIdcard(value);
|
||||
},"请输入正确的身份证号码(15-18位)")
|
||||
|
||||
//验证身份证函数
|
||||
function checkIdcard(idcard){
|
||||
idcard = idcard.toString();
|
||||
//var Errors=new Array("验证通过!","身份证号码位数不对!","身份证号码出生日期超出范围或含有非法字符!","身份证号码校验错误!","身份证地区非法!");
|
||||
var Errors=new Array(true,false,false,false,false);
|
||||
var area={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"}
|
||||
var idcard,Y,JYM;
|
||||
var S,M;
|
||||
var idcard_array = new Array();
|
||||
idcard_array = idcard.split("");
|
||||
//地区检验
|
||||
if(area[parseInt(idcard.substr(0,2))]==null) return Errors[4];
|
||||
//身份号码位数及格式检验
|
||||
switch(idcard.length){
|
||||
case 15:
|
||||
if ( (parseInt(idcard.substr(6,2))+1900) % 4 == 0 || ((parseInt(idcard.substr(6,2))+1900) % 100 == 0 && (parseInt(idcard.substr(6,2))+1900) % 4 == 0 )){
|
||||
ereg=/^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/;//测试出生日期的合法性
|
||||
} else {
|
||||
ereg=/^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/;//测试出生日期的合法性
|
||||
}
|
||||
if(ereg.test(idcard)) return Errors[0];
|
||||
else return Errors[2];
|
||||
break;
|
||||
case 18:
|
||||
//18 位身份号码检测
|
||||
//出生日期的合法性检查
|
||||
//闰年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))
|
||||
//平年月日:((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))
|
||||
if ( parseInt(idcard.substr(6,4)) % 4 == 0 || (parseInt(idcard.substr(6,4)) % 100 == 0 && parseInt(idcard.substr(6,4))%4 == 0 )){
|
||||
ereg=/^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/;//闰年出生日期的合法性正则表达式
|
||||
} else {
|
||||
ereg=/^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/;//平年出生日期的合法性正则表达式
|
||||
}
|
||||
if(ereg.test(idcard)) {//测试出生日期的合法性
|
||||
//计算校验位
|
||||
S = (parseInt(idcard_array[0]) + parseInt(idcard_array[10])) * 7
|
||||
+ (parseInt(idcard_array[1]) + parseInt(idcard_array[11])) * 9
|
||||
+ (parseInt(idcard_array[2]) + parseInt(idcard_array[12])) * 10
|
||||
+ (parseInt(idcard_array[3]) + parseInt(idcard_array[13])) * 5
|
||||
+ (parseInt(idcard_array[4]) + parseInt(idcard_array[14])) * 8
|
||||
+ (parseInt(idcard_array[5]) + parseInt(idcard_array[15])) * 4
|
||||
+ (parseInt(idcard_array[6]) + parseInt(idcard_array[16])) * 2
|
||||
+ parseInt(idcard_array[7]) * 1
|
||||
+ parseInt(idcard_array[8]) * 6
|
||||
+ parseInt(idcard_array[9]) * 3 ;
|
||||
Y = S % 11;
|
||||
M = "F";
|
||||
JYM = "10X98765432";
|
||||
M = JYM.substr(Y,1);//判断校验位
|
||||
if(M == idcard_array[17]) return Errors[0]; //检测ID的校验位
|
||||
else return Errors[3];
|
||||
}
|
||||
else return Errors[2];
|
||||
break;
|
||||
default:
|
||||
return Errors[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
3
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/jquery.validate.method.min.js
vendored
Normal file
3
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/jquery.validate.method.min.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
(function(a){a.extend(a.validator.messages,{required:"必填信息",remote:"请修正该信息",email:"请输入正确格式的电子邮件",url:"请输入合法的网址",date:"请输入合法的日期",dateISO:"请输入合法的日期 (ISO).",number:"请输入合法的数字",digits:"只能输入整数",creditcard:"请输入合法的信用卡号",equalTo:"请再次输入相同的值",accept:"请输入拥有合法后缀名的字符串",maxlength:a.validator.format("请输入一个长度最多是 {0} 的字符串"),minlength:a.validator.format("请输入一个长度最少是 {0} 的字符串"),rangelength:a.validator.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"),range:a.validator.format("请输入一个介于 {0} 和 {1} 之间的值"),max:a.validator.format("请输入一个最大为 {0} 的值"),min:a.validator.format("请输入一个最小为 {0} 的值")})}(jQuery));jQuery.validator.addMethod("ip",function(b,a){return this.optional(a)||(/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/.test(b)&&(RegExp.$1<256&&RegExp.$2<256&&RegExp.$3<256&&RegExp.$4<256))},"请输入合法的IP地址");jQuery.validator.addMethod("abc",function(b,a){return this.optional(a)||/^[a-zA-Z0-9_]*$/.test(b)},"请输入字母数字或下划线");jQuery.validator.addMethod("username",function(b,a){return this.optional(a)||/^[a-zA-Z0-9][a-zA-Z0-9_]{2,19}$/.test(b)},"3-20位字母或数字开头,允许字母数字下划线");jQuery.validator.addMethod("noEqualTo",function(b,a,c){return b!=$(c).val()},"请再次输入不同的值");jQuery.validator.addMethod("gt",function(b,a,c){return b>$(c).val()},"请输入更大的值");jQuery.validator.addMethod("lt",function(b,a,c){return b<$(c).val()},"请输入更小的值");jQuery.validator.addMethod("realName",function(b,a){return this.optional(a)||/^[\u4e00-\u9fa5]{2,30}$/.test(b)},"姓名只能为2-30个汉字");jQuery.validator.addMethod("userName",function(b,a){return this.optional(a)||/^[\u0391-\uFFE5\w]+$/.test(b)},"登录名只能包括中文字、英文字母、数字和下划线");jQuery.validator.addMethod("mobile",function(c,a){var b=c.length;return this.optional(a)||(b==11&&/^(((13[0-9]{1})|(15[0-9]{1}))+\d{8})$/.test(c))},"请正确填写您的手机号码");jQuery.validator.addMethod("simplePhone",function(c,b){var a=/^(\d{3,4}-?)?\d{7,9}$/g;return this.optional(b)||(a.test(c))},"请正确填写您的电话号码");jQuery.validator.addMethod("phone",function(c,b){var a=/(^0[1-9]{1}\d{9,10}$)|(^1[3,5,8]\d{9}$)/g;return this.optional(b)||(a.test(c))},"格式为:固话为区号(3-4位)号码(7-9位),手机为:13,15,18号段");jQuery.validator.addMethod("zipCode",function(c,b){var a=/^[0-9]{6}$/;
|
||||
return this.optional(b)||(a.test(c))},"请正确填写您的邮政编码");jQuery.validator.addMethod("qq",function(c,b){var a=/^[1-9][0-9]{4,}$/;return this.optional(b)||(a.test(c))},"请正确填写您的QQ号码");jQuery.validator.addMethod("card",function(b,a){return this.optional(a)||checkIdcard(b)},"请输入正确的身份证号码(15-18位)");function checkIdcard(d){d=d.toString();var f=new Array(true,false,false,false,false);var e={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"};var d,g,b;var c,h;var a=new Array();a=d.split("");if(e[parseInt(d.substr(0,2))]==null){return f[4]}switch(d.length){case 15:if((parseInt(d.substr(6,2))+1900)%4==0||((parseInt(d.substr(6,2))+1900)%100==0&&(parseInt(d.substr(6,2))+1900)%4==0)){ereg=/^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}$/}else{ereg=/^[1-9][0-9]{5}[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}$/}if(ereg.test(d)){return f[0]}else{return f[2]}break;case 18:if(parseInt(d.substr(6,4))%4==0||(parseInt(d.substr(6,4))%100==0&&parseInt(d.substr(6,4))%4==0)){ereg=/^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|[1-2][0-9]))[0-9]{3}[0-9Xx]$/}else{ereg=/^[1-9][0-9]{5}19[0-9]{2}((01|03|05|07|08|10|12)(0[1-9]|[1-2][0-9]|3[0-1])|(04|06|09|11)(0[1-9]|[1-2][0-9]|30)|02(0[1-9]|1[0-9]|2[0-8]))[0-9]{3}[0-9Xx]$/}if(ereg.test(d)){c=(parseInt(a[0])+parseInt(a[10]))*7+(parseInt(a[1])+parseInt(a[11]))*9+(parseInt(a[2])+parseInt(a[12]))*10+(parseInt(a[3])+parseInt(a[13]))*5+(parseInt(a[4])+parseInt(a[14]))*8+(parseInt(a[5])+parseInt(a[15]))*4+(parseInt(a[6])+parseInt(a[16]))*2+parseInt(a[7])*1+parseInt(a[8])*6+parseInt(a[9])*3;g=c%11;h="F";b="10X98765432";h=b.substr(g,1);if(h==a[17]){return f[0]
|
||||
}else{return f[3]}}else{return f[2]}break;default:return f[1];break}};
|
||||
1
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/jquery.validate.min.css
vendored
Normal file
1
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/jquery.validate.min.css
vendored
Normal file
@@ -0,0 +1 @@
|
||||
label.error{background:url("images/unchecked.gif") no-repeat 0 0;padding-left:18px;padding-bottom:2px;font-weight:bold;color:#ea5200;margin-left:10px}
|
||||
2
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/jquery.validate.min.js
vendored
Normal file
2
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/jquery.validate.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
9046
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery-1.6.4.js
vendored
Normal file
9046
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery-1.6.4.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9404
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery-1.7.2.js
vendored
Normal file
9404
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery-1.7.2.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9472
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery-1.8.3.js
vendored
Normal file
9472
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery-1.8.3.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
9555
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery-1.9.0.js
vendored
Normal file
9555
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery-1.9.0.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
27
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery.js
vendored
Normal file
27
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/lib/jquery.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
(function() {
|
||||
|
||||
var parts = document.location.search.slice( 1 ).split( "&" ),
|
||||
length = parts.length,
|
||||
scripts = document.getElementsByTagName("script"),
|
||||
src = scripts[ scripts.length - 1].src,
|
||||
i = 0,
|
||||
current,
|
||||
version = "1.9.0",
|
||||
file = "http://code.jquery.com/jquery-git.js";
|
||||
|
||||
for ( ; i < length; i++ ) {
|
||||
current = parts[ i ].split( "=" );
|
||||
if ( current[ 0 ] === "jquery" ) {
|
||||
version = current[ 1 ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (version != "git") {
|
||||
file = src.replace(/jquery\.js$/, "jquery-" + version + ".js");
|
||||
}
|
||||
|
||||
|
||||
document.write( "<script src='" + file + "'></script>" );
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,382 @@
|
||||
/*!
|
||||
* MockJax - jQuery Plugin to Mock Ajax requests
|
||||
*
|
||||
* Version: 1.4.0
|
||||
* Released: 2011-02-04
|
||||
* Source: http://github.com/appendto/jquery-mockjax
|
||||
* Docs: http://enterprisejquery.com/2010/07/mock-your-ajax-requests-with-mockjax-for-rapid-development
|
||||
* Plugin: mockjax
|
||||
* Author: Jonathan Sharp (http://jdsharp.com)
|
||||
* License: MIT,GPL
|
||||
*
|
||||
* Copyright (c) 2010 appendTo LLC.
|
||||
* Dual licensed under the MIT or GPL licenses.
|
||||
* http://appendto.com/open-source-licenses
|
||||
*/
|
||||
(function($) {
|
||||
var _ajax = $.ajax,
|
||||
mockHandlers = [];
|
||||
|
||||
function parseXML(xml) {
|
||||
if ( window['DOMParser'] == undefined && window.ActiveXObject ) {
|
||||
DOMParser = function() { };
|
||||
DOMParser.prototype.parseFromString = function( xmlString ) {
|
||||
var doc = new ActiveXObject('Microsoft.XMLDOM');
|
||||
doc.async = 'false';
|
||||
doc.loadXML( xmlString );
|
||||
return doc;
|
||||
};
|
||||
}
|
||||
|
||||
try {
|
||||
var xmlDoc = ( new DOMParser() ).parseFromString( xml, 'text/xml' );
|
||||
if ( $.isXMLDoc( xmlDoc ) ) {
|
||||
var err = $('parsererror', xmlDoc);
|
||||
if ( err.length == 1 ) {
|
||||
throw('Error: ' + $(xmlDoc).text() );
|
||||
}
|
||||
} else {
|
||||
throw('Unable to parse XML');
|
||||
}
|
||||
} catch( e ) {
|
||||
var msg = ( e.name == undefined ? e : e.name + ': ' + e.message );
|
||||
$(document).trigger('xmlParseError', [ msg ]);
|
||||
return undefined;
|
||||
}
|
||||
return xmlDoc;
|
||||
}
|
||||
|
||||
$.extend({
|
||||
ajax: function(origSettings) {
|
||||
var s = jQuery.extend(true, {}, jQuery.ajaxSettings, origSettings),
|
||||
mock = false;
|
||||
// Iterate over our mock handlers (in registration order) until we find
|
||||
// one that is willing to intercept the request
|
||||
$.each(mockHandlers, function(k, v) {
|
||||
if ( !mockHandlers[k] ) {
|
||||
return;
|
||||
}
|
||||
var m = null;
|
||||
// If the mock was registered with a function, let the function decide if we
|
||||
// want to mock this request
|
||||
if ( $.isFunction(mockHandlers[k]) ) {
|
||||
m = mockHandlers[k](s);
|
||||
} else {
|
||||
m = mockHandlers[k];
|
||||
// Inspect the URL of the request and check if the mock handler's url
|
||||
// matches the url for this ajax request
|
||||
if ( $.isFunction(m.url.test) ) {
|
||||
// The user provided a regex for the url, test it
|
||||
if ( !m.url.test( s.url ) ) {
|
||||
m = null;
|
||||
}
|
||||
} else {
|
||||
// Look for a simple wildcard '*' or a direct URL match
|
||||
var star = m.url.indexOf('*');
|
||||
if ( ( m.url != '*' && m.url != s.url && star == -1 ) ||
|
||||
( star > -1 && m.url.substr(0, star) != s.url.substr(0, star) ) ) {
|
||||
// The url we tested did not match the wildcard *
|
||||
m = null;
|
||||
}
|
||||
}
|
||||
if ( m ) {
|
||||
// Inspect the data submitted in the request (either POST body or GET query string)
|
||||
if ( m.data && s.data ) {
|
||||
var identical = false;
|
||||
// Deep inspect the identity of the objects
|
||||
(function ident(mock, live) {
|
||||
// Test for situations where the data is a querystring (not an object)
|
||||
if (typeof live === 'string') {
|
||||
// Querystring may be a regex
|
||||
identical = $.isFunction( mock.test ) ? mock.test(live) : mock == live;
|
||||
return identical;
|
||||
}
|
||||
$.each(mock, function(k, v) {
|
||||
if ( live[k] === undefined ) {
|
||||
identical = false;
|
||||
return false;
|
||||
} else {
|
||||
identical = true;
|
||||
if ( typeof live[k] == 'object' ) {
|
||||
return ident(mock[k], live[k]);
|
||||
} else {
|
||||
if ( $.isFunction( mock[k].test ) ) {
|
||||
identical = mock[k].test(live[k]);
|
||||
} else {
|
||||
identical = ( mock[k] == live[k] );
|
||||
}
|
||||
return identical;
|
||||
}
|
||||
}
|
||||
});
|
||||
})(m.data, s.data);
|
||||
// They're not identical, do not mock this request
|
||||
if ( identical == false ) {
|
||||
m = null;
|
||||
}
|
||||
}
|
||||
// Inspect the request type
|
||||
if ( m && m.type && m.type != s.type ) {
|
||||
// The request type doesn't match (GET vs. POST)
|
||||
m = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( m ) {
|
||||
mock = true;
|
||||
|
||||
// Handle console logging
|
||||
var c = $.extend({}, $.mockjaxSettings, m);
|
||||
if ( c.log && $.isFunction(c.log) ) {
|
||||
c.log('MOCK ' + s.type.toUpperCase() + ': ' + s.url, $.extend({}, s));
|
||||
}
|
||||
|
||||
var jsre = /=\?(&|$)/, jsc = (new Date()).getTime();
|
||||
|
||||
// Handle JSONP Parameter Callbacks, we need to replicate some of the jQuery core here
|
||||
// because there isn't an easy hook for the cross domain script tag of jsonp
|
||||
if ( s.dataType === "jsonp" ) {
|
||||
if ( s.type.toUpperCase() === "GET" ) {
|
||||
if ( !jsre.test( s.url ) ) {
|
||||
s.url += (rquery.test( s.url ) ? "&" : "?") + (s.jsonp || "callback") + "=?";
|
||||
}
|
||||
} else if ( !s.data || !jsre.test(s.data) ) {
|
||||
s.data = (s.data ? s.data + "&" : "") + (s.jsonp || "callback") + "=?";
|
||||
}
|
||||
s.dataType = "json";
|
||||
}
|
||||
|
||||
// Build temporary JSONP function
|
||||
if ( s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(s.url)) ) {
|
||||
jsonp = s.jsonpCallback || ("jsonp" + jsc++);
|
||||
|
||||
// Replace the =? sequence both in the query string and the data
|
||||
if ( s.data ) {
|
||||
s.data = (s.data + "").replace(jsre, "=" + jsonp + "$1");
|
||||
}
|
||||
|
||||
s.url = s.url.replace(jsre, "=" + jsonp + "$1");
|
||||
|
||||
// We need to make sure
|
||||
// that a JSONP style response is executed properly
|
||||
s.dataType = "script";
|
||||
|
||||
// Handle JSONP-style loading
|
||||
window[ jsonp ] = window[ jsonp ] || function( tmp ) {
|
||||
data = tmp;
|
||||
success();
|
||||
complete();
|
||||
// Garbage collect
|
||||
window[ jsonp ] = undefined;
|
||||
|
||||
try {
|
||||
delete window[ jsonp ];
|
||||
} catch(e) {}
|
||||
|
||||
if ( head ) {
|
||||
head.removeChild( script );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var rurl = /^(\w+:)?\/\/([^\/?#]+)/,
|
||||
parts = rurl.exec( s.url ),
|
||||
remote = parts && (parts[1] && parts[1] !== location.protocol || parts[2] !== location.host);
|
||||
|
||||
// Test if we are going to create a script tag (if so, intercept & mock)
|
||||
if ( s.dataType === "script" && s.type.toUpperCase() === "GET" && remote ) {
|
||||
// Synthesize the mock request for adding a script tag
|
||||
var callbackContext = origSettings && origSettings.context || s;
|
||||
|
||||
function success() {
|
||||
// If a local callback was specified, fire it and pass it the data
|
||||
if ( s.success ) {
|
||||
s.success.call( callbackContext, ( m.response ? m.response.toString() : m.responseText || ''), status, {} );
|
||||
}
|
||||
|
||||
// Fire the global callback
|
||||
if ( s.global ) {
|
||||
trigger( "ajaxSuccess", [{}, s] );
|
||||
}
|
||||
}
|
||||
|
||||
function complete() {
|
||||
// Process result
|
||||
if ( s.complete ) {
|
||||
s.complete.call( callbackContext, {} , status );
|
||||
}
|
||||
|
||||
// The request was completed
|
||||
if ( s.global ) {
|
||||
trigger( "ajaxComplete", [{}, s] );
|
||||
}
|
||||
|
||||
// Handle the global AJAX counter
|
||||
if ( s.global && ! --jQuery.active ) {
|
||||
jQuery.event.trigger( "ajaxStop" );
|
||||
}
|
||||
}
|
||||
|
||||
function trigger(type, args) {
|
||||
(s.context ? jQuery(s.context) : jQuery.event).trigger(type, args);
|
||||
}
|
||||
|
||||
if ( m.response && $.isFunction(m.response) ) {
|
||||
m.response(origSettings);
|
||||
} else {
|
||||
$.globalEval(m.responseText);
|
||||
}
|
||||
success();
|
||||
complete();
|
||||
return false;
|
||||
}
|
||||
mock = _ajax.call($, $.extend(true, {}, origSettings, {
|
||||
// Mock the XHR object
|
||||
xhr: function() {
|
||||
// Extend with our default mockjax settings
|
||||
m = $.extend({}, $.mockjaxSettings, m);
|
||||
|
||||
if ( m.contentType ) {
|
||||
m.headers['content-type'] = m.contentType;
|
||||
}
|
||||
|
||||
// Return our mock xhr object
|
||||
return {
|
||||
status: m.status,
|
||||
readyState: 1,
|
||||
open: function() { },
|
||||
send: function() {
|
||||
// This is a substitute for < 1.4 which lacks $.proxy
|
||||
var process = (function(that) {
|
||||
return function() {
|
||||
return (function() {
|
||||
// The request has returned
|
||||
this.status = m.status;
|
||||
this.readyState = 4;
|
||||
|
||||
// We have an executable function, call it to give
|
||||
// the mock handler a chance to update it's data
|
||||
if ( $.isFunction(m.response) ) {
|
||||
m.response(origSettings);
|
||||
}
|
||||
// Copy over our mock to our xhr object before passing control back to
|
||||
// jQuery's onreadystatechange callback
|
||||
if ( s.dataType == 'json' && ( typeof m.responseText == 'object' ) ) {
|
||||
this.responseText = JSON.stringify(m.responseText);
|
||||
} else if ( s.dataType == 'xml' ) {
|
||||
if ( typeof m.responseXML == 'string' ) {
|
||||
this.responseXML = parseXML(m.responseXML);
|
||||
} else {
|
||||
this.responseXML = m.responseXML;
|
||||
}
|
||||
} else {
|
||||
this.responseText = m.responseText;
|
||||
}
|
||||
// jQuery < 1.4 doesn't have onreadystate change for xhr
|
||||
if ( $.isFunction(this.onreadystatechange) ) {
|
||||
this.onreadystatechange( m.isTimeout ? 'timeout' : undefined );
|
||||
}
|
||||
}).apply(that);
|
||||
};
|
||||
})(this);
|
||||
|
||||
if ( m.proxy ) {
|
||||
// We're proxying this request and loading in an external file instead
|
||||
_ajax({
|
||||
global: false,
|
||||
url: m.proxy,
|
||||
type: m.proxyType,
|
||||
data: m.data,
|
||||
dataType: s.dataType,
|
||||
complete: function(xhr, txt) {
|
||||
m.responseXML = xhr.responseXML;
|
||||
m.responseText = xhr.responseText;
|
||||
this.responseTimer = setTimeout(process, m.responseTime || 0);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
// type == 'POST' || 'GET' || 'DELETE'
|
||||
if ( s.async === false ) {
|
||||
// TODO: Blocking delay
|
||||
process();
|
||||
} else {
|
||||
this.responseTimer = setTimeout(process, m.responseTime || 50);
|
||||
}
|
||||
}
|
||||
},
|
||||
abort: function() {
|
||||
clearTimeout(this.responseTimer);
|
||||
},
|
||||
setRequestHeader: function() { },
|
||||
getResponseHeader: function(header) {
|
||||
// 'Last-modified', 'Etag', 'content-type' are all checked by jQuery
|
||||
if ( m.headers && m.headers[header] ) {
|
||||
// Return arbitrary headers
|
||||
return m.headers[header];
|
||||
} else if ( header.toLowerCase() == 'last-modified' ) {
|
||||
return m.lastModified || (new Date()).toString();
|
||||
} else if ( header.toLowerCase() == 'etag' ) {
|
||||
return m.etag || '';
|
||||
} else if ( header.toLowerCase() == 'content-type' ) {
|
||||
return m.contentType || 'text/plain';
|
||||
}
|
||||
},
|
||||
getAllResponseHeaders: function() {
|
||||
var headers = '';
|
||||
$.each(m.headers, function(k, v) {
|
||||
headers += k + ': ' + v + "\n";
|
||||
});
|
||||
return headers;
|
||||
}
|
||||
};
|
||||
}
|
||||
}));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// We don't have a mock request, trigger a normal request
|
||||
if ( !mock ) {
|
||||
return _ajax.apply($, arguments);
|
||||
} else {
|
||||
return mock;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.mockjaxSettings = {
|
||||
//url: null,
|
||||
//type: 'GET',
|
||||
log: function(msg) {
|
||||
window['console'] && window.console.log && window.console.log(msg);
|
||||
},
|
||||
status: 200,
|
||||
responseTime: 500,
|
||||
isTimeout: false,
|
||||
contentType: 'text/plain',
|
||||
response: '',
|
||||
responseText: '',
|
||||
responseXML: '',
|
||||
proxy: '',
|
||||
proxyType: 'GET',
|
||||
|
||||
lastModified: null,
|
||||
etag: '',
|
||||
headers: {
|
||||
etag: 'IJF@H#@923uf8023hFO@I#H#',
|
||||
'content-type' : 'text/plain'
|
||||
}
|
||||
};
|
||||
|
||||
$.mockjax = function(settings) {
|
||||
var i = mockHandlers.length;
|
||||
mockHandlers[i] = settings;
|
||||
return i;
|
||||
};
|
||||
$.mockjaxClear = function(i) {
|
||||
if ( arguments.length == 1 ) {
|
||||
mockHandlers[i] = null;
|
||||
} else {
|
||||
mockHandlers = [];
|
||||
}
|
||||
};
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: AR (Arabic; العربية)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "هذا الحقل إلزامي",
|
||||
remote: "يرجى تصحيح هذا الحقل للمتابعة",
|
||||
email: "رجاء إدخال عنوان بريد إلكتروني صحيح",
|
||||
url: "رجاء إدخال عنوان موقع إلكتروني صحيح",
|
||||
date: "رجاء إدخال تاريخ صحيح",
|
||||
dateISO: "رجاء إدخال تاريخ صحيح (ISO)",
|
||||
number: "رجاء إدخال عدد بطريقة صحيحة",
|
||||
digits: "رجاء إدخال أرقام فقط",
|
||||
creditcard: "رجاء إدخال رقم بطاقة ائتمان صحيح",
|
||||
equalTo: "رجاء إدخال نفس القيمة",
|
||||
accept: "رجاء إدخال ملف بامتداد موافق عليه",
|
||||
maxlength: $.validator.format("الحد الأقصى لعدد الحروف هو {0}"),
|
||||
minlength: $.validator.format("الحد الأدنى لعدد الحروف هو {0}"),
|
||||
rangelength: $.validator.format("عدد الحروف يجب أن يكون بين {0} و {1}"),
|
||||
range: $.validator.format("رجاء إدخال عدد قيمته بين {0} و {1}"),
|
||||
max: $.validator.format("رجاء إدخال عدد أقل من أو يساوي (0}"),
|
||||
min: $.validator.format("رجاء إدخال عدد أكبر من أو يساوي (0}")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: BG (Bulgarian; български език)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Полето е задължително.",
|
||||
remote: "Моля, въведете правилната стойност.",
|
||||
email: "Моля, въведете валиден email.",
|
||||
url: "Моля, въведете валидно URL.",
|
||||
date: "Моля, въведете валидна дата.",
|
||||
dateISO: "Моля, въведете валидна дата (ISO).",
|
||||
number: "Моля, въведете валиден номер.",
|
||||
digits: "Моля, въведете само цифри",
|
||||
creditcard: "Моля, въведете валиден номер на кредитна карта.",
|
||||
equalTo: "Моля, въведете същата стойност отново.",
|
||||
accept: "Моля, въведете стойност с валидно разширение.",
|
||||
maxlength: $.validator.format("Моля, въведете повече от {0} символа."),
|
||||
minlength: $.validator.format("Моля, въведете поне {0} символа."),
|
||||
rangelength: $.validator.format("Моля, въведете стойност с дължина между {0} и {1} символа."),
|
||||
range: $.validator.format("Моля, въведете стойност между {0} и {1}."),
|
||||
max: $.validator.format("Моля, въведете стойност по-малка или равна на {0}."),
|
||||
min: $.validator.format("Моля, въведете стойност по-голяма или равна на {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: CA (Catalan; català)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Aquest camp és obligatori.",
|
||||
remote: "Si us plau, omple aquest camp.",
|
||||
email: "Si us plau, escriu una adreça de correu-e vàlida",
|
||||
url: "Si us plau, escriu una URL vàlida.",
|
||||
date: "Si us plau, escriu una data vàlida.",
|
||||
dateISO: "Si us plau, escriu una data (ISO) vàlida.",
|
||||
number: "Si us plau, escriu un número enter vàlid.",
|
||||
digits: "Si us plau, escriu només dígits.",
|
||||
creditcard: "Si us plau, escriu un número de tarjeta vàlid.",
|
||||
equalTo: "Si us plau, escriu el maateix valor de nou.",
|
||||
accept: "Si us plau, escriu un valor amb una extensió acceptada.",
|
||||
maxlength: $.validator.format("Si us plau, no escriguis més de {0} caracters."),
|
||||
minlength: $.validator.format("Si us plau, no escriguis menys de {0} caracters."),
|
||||
rangelength: $.validator.format("Si us plau, escriu un valor entre {0} i {1} caracters."),
|
||||
range: $.validator.format("Si us plau, escriu un valor entre {0} i {1}."),
|
||||
max: $.validator.format("Si us plau, escriu un valor menor o igual a {0}."),
|
||||
min: $.validator.format("Si us plau, escriu un valor major o igual a {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: CS (Czech; čeština, český jazyk)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Tento údaj je povinný.",
|
||||
remote: "Prosím, opravte tento údaj.",
|
||||
email: "Prosím, zadejte platný e-mail.",
|
||||
url: "Prosím, zadejte platné URL.",
|
||||
date: "Prosím, zadejte platné datum.",
|
||||
dateISO: "Prosím, zadejte platné datum (ISO).",
|
||||
number: "Prosím, zadejte číslo.",
|
||||
digits: "Prosím, zadávejte pouze číslice.",
|
||||
creditcard: "Prosím, zadejte číslo kreditní karty.",
|
||||
equalTo: "Prosím, zadejte znovu stejnou hodnotu.",
|
||||
accept: "Prosím, zadejte soubor se správnou příponou.",
|
||||
maxlength: $.validator.format("Prosím, zadejte nejvíce {0} znaků."),
|
||||
minlength: $.validator.format("Prosím, zadejte nejméně {0} znaků."),
|
||||
rangelength: $.validator.format("Prosím, zadejte od {0} do {1} znaků."),
|
||||
range: $.validator.format("Prosím, zadejte hodnotu od {0} do {1}."),
|
||||
max: $.validator.format("Prosím, zadejte hodnotu menší nebo rovnu {0}."),
|
||||
min: $.validator.format("Prosím, zadejte hodnotu větší nebo rovnu {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: DA (Danish; dansk)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Dette felt er påkrævet.",
|
||||
maxlength: $.validator.format("Indtast højst {0} tegn."),
|
||||
minlength: $.validator.format("Indtast mindst {0} tegn."),
|
||||
rangelength: $.validator.format("Indtast mindst {0} og højst {1} tegn."),
|
||||
email: "Indtast en gyldig email-adresse.",
|
||||
url: "Indtast en gyldig URL.",
|
||||
date: "Indtast en gyldig dato.",
|
||||
number: "Indtast et tal.",
|
||||
digits: "Indtast kun cifre.",
|
||||
equalTo: "Indtast den samme værdi igen.",
|
||||
range: $.validator.format("Angiv en værdi mellem {0} og {1}."),
|
||||
max: $.validator.format("Angiv en værdi der højst er {0}."),
|
||||
min: $.validator.format("Angiv en værdi der mindst er {0}."),
|
||||
creditcard: "Indtast et gyldigt kreditkortnummer."
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: DE (German, Deutsch)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Dieses Feld ist ein Pflichtfeld.",
|
||||
maxlength: $.validator.format("Geben Sie bitte maximal {0} Zeichen ein."),
|
||||
minlength: $.validator.format("Geben Sie bitte mindestens {0} Zeichen ein."),
|
||||
rangelength: $.validator.format("Geben Sie bitte mindestens {0} und maximal {1} Zeichen ein."),
|
||||
email: "Geben Sie bitte eine gültige E-Mail Adresse ein.",
|
||||
url: "Geben Sie bitte eine gültige URL ein.",
|
||||
date: "Bitte geben Sie ein gültiges Datum ein.",
|
||||
number: "Geben Sie bitte eine Nummer ein.",
|
||||
digits: "Geben Sie bitte nur Ziffern ein.",
|
||||
equalTo: "Bitte denselben Wert wiederholen.",
|
||||
range: $.validator.format("Geben Sie bitte einen Wert zwischen {0} und {1} ein."),
|
||||
max: $.validator.format("Geben Sie bitte einen Wert kleiner oder gleich {0} ein."),
|
||||
min: $.validator.format("Geben Sie bitte einen Wert größer oder gleich {0} ein."),
|
||||
creditcard: "Geben Sie bitte eine gültige Kreditkarten-Nummer ein."
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: EL (Greek; ελληνικά)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Αυτό το πεδίο είναι υποχρεωτικό.",
|
||||
remote: "Παρακαλώ διορθώστε αυτό το πεδίο.",
|
||||
email: "Παρακαλώ εισάγετε μια έγκυρη διεύθυνση email.",
|
||||
url: "Παρακαλώ εισάγετε ένα έγκυρο URL.",
|
||||
date: "Παρακαλώ εισάγετε μια έγκυρη ημερομηνία.",
|
||||
dateISO: "Παρακαλώ εισάγετε μια έγκυρη ημερομηνία (ISO).",
|
||||
number: "Παρακαλώ εισάγετε έναν έγκυρο αριθμό.",
|
||||
digits: "Παρακαλώ εισάγετε μόνο αριθμητικά ψηφία.",
|
||||
creditcard: "Παρακαλώ εισάγετε έναν έγκυρο αριθμό πιστωτικής κάρτας.",
|
||||
equalTo: "Παρακαλώ εισάγετε την ίδια τιμή ξανά.",
|
||||
accept: "Παρακαλώ εισάγετε μια τιμή με έγκυρη επέκταση αρχείου.",
|
||||
maxlength: $.validator.format("Παρακαλώ εισάγετε μέχρι και {0} χαρακτήρες."),
|
||||
minlength: $.validator.format("Παρακαλώ εισάγετε τουλάχιστον {0} χαρακτήρες."),
|
||||
rangelength: $.validator.format("Παρακαλώ εισάγετε μια τιμή με μήκος μεταξύ {0} και {1} χαρακτήρων."),
|
||||
range: $.validator.format("Παρακαλώ εισάγετε μια τιμή μεταξύ {0} και {1}."),
|
||||
max: $.validator.format("Παρακαλώ εισάγετε μια τιμή μικρότερη ή ίση του {0}."),
|
||||
min: $.validator.format("Παρακαλώ εισάγετε μια τιμή μεγαλύτερη ή ίση του {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: ES (Spanish; Español)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Este campo es obligatorio.",
|
||||
remote: "Por favor, rellena este campo.",
|
||||
email: "Por favor, escribe una dirección de correo válida",
|
||||
url: "Por favor, escribe una URL válida.",
|
||||
date: "Por favor, escribe una fecha válida.",
|
||||
dateISO: "Por favor, escribe una fecha (ISO) válida.",
|
||||
number: "Por favor, escribe un número entero válido.",
|
||||
digits: "Por favor, escribe sólo dígitos.",
|
||||
creditcard: "Por favor, escribe un número de tarjeta válido.",
|
||||
equalTo: "Por favor, escribe el mismo valor de nuevo.",
|
||||
accept: "Por favor, escribe un valor con una extensión aceptada.",
|
||||
maxlength: $.validator.format("Por favor, no escribas más de {0} caracteres."),
|
||||
minlength: $.validator.format("Por favor, no escribas menos de {0} caracteres."),
|
||||
rangelength: $.validator.format("Por favor, escribe un valor entre {0} y {1} caracteres."),
|
||||
range: $.validator.format("Por favor, escribe un valor entre {0} y {1}."),
|
||||
max: $.validator.format("Por favor, escribe un valor menor o igual a {0}."),
|
||||
min: $.validator.format("Por favor, escribe un valor mayor o igual a {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: ET (Estonian; eesti, eesti keel)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "See väli peab olema täidetud.",
|
||||
maxlength: $.validator.format("Palun sisestage vähem kui {0} tähemärki."),
|
||||
minlength: $.validator.format("Palun sisestage vähemalt {0} tähemärki."),
|
||||
rangelength: $.validator.format("Palun sisestage väärtus vahemikus {0} kuni {1} tähemärki."),
|
||||
email: "Palun sisestage korrektne e-maili aadress.",
|
||||
url: "Palun sisestage korrektne URL.",
|
||||
date: "Palun sisestage korrektne kuupäev.",
|
||||
dateISO: "Palun sisestage korrektne kuupäev (YYYY-MM-DD).",
|
||||
number: "Palun sisestage korrektne number.",
|
||||
digits: "Palun sisestage ainult numbreid.",
|
||||
equalTo: "Palun sisestage sama väärtus uuesti.",
|
||||
range: $.validator.format("Palun sisestage väärtus vahemikus {0} kuni {1}."),
|
||||
max: $.validator.format("Palun sisestage väärtus, mis on väiksem või võrdne arvuga {0}."),
|
||||
min: $.validator.format("Palun sisestage väärtus, mis on suurem või võrdne arvuga {0}."),
|
||||
creditcard: "Palun sisestage korrektne krediitkaardi number."
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: EU (Basque; euskara, euskera)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Eremu hau beharrezkoa da.",
|
||||
remote: "Mesedez, bete eremu hau.",
|
||||
email: "Mesedez, idatzi baliozko posta helbide bat.",
|
||||
url: "Mesedez, idatzi baliozko URL bat.",
|
||||
date: "Mesedez, idatzi baliozko data bat.",
|
||||
dateISO: "Mesedez, idatzi baliozko (ISO) data bat.",
|
||||
number: "Mesedez, idatzi baliozko zenbaki oso bat.",
|
||||
digits: "Mesedez, idatzi digituak soilik.",
|
||||
creditcard: "Mesedez, idatzi baliozko txartel zenbaki bat.",
|
||||
equalTo: "Mesedez, idatzi berdina berriro ere.",
|
||||
accept: "Mesedez, idatzi onartutako luzapena duen balio bat.",
|
||||
maxlength: $.validator.format("Mesedez, ez idatzi {0} karaktere baino gehiago."),
|
||||
minlength: $.validator.format("Mesedez, ez idatzi {0} karaktere baino gutxiago."),
|
||||
rangelength: $.validator.format("Mesedez, idatzi {0} eta {1} karaktere arteko balio bat."),
|
||||
range: $.validator.format("Mesedez, idatzi {0} eta {1} arteko balio bat."),
|
||||
max: $.validator.format("Mesedez, idatzi {0} edo txikiagoa den balio bat."),
|
||||
min: $.validator.format("Mesedez, idatzi {0} edo handiagoa den balio bat.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: FA (Persian; فارسی)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "تکمیل این فیلد اجباری است.",
|
||||
remote: "لطفا این فیلد را تصحیح کنید.",
|
||||
email: ".لطفا یک ایمیل صحیح وارد کنید",
|
||||
url: "لطفا آدرس صحیح وارد کنید.",
|
||||
date: "لطفا یک تاریخ صحیح وارد کنید",
|
||||
dateISO: "لطفا تاریخ صحیح وارد کنید (ISO).",
|
||||
number: "لطفا عدد صحیح وارد کنید.",
|
||||
digits: "لطفا تنها رقم وارد کنید",
|
||||
creditcard: "لطفا کریدیت کارت صحیح وارد کنید.",
|
||||
equalTo: "لطفا مقدار برابری وارد کنید",
|
||||
accept: "لطفا مقداری وارد کنید که ",
|
||||
maxlength: $.validator.format("لطفا بیشتر از {0} حرف وارد نکنید."),
|
||||
minlength: $.validator.format("لطفا کمتر از {0} حرف وارد نکنید."),
|
||||
rangelength: $.validator.format("لطفا مقداری بین {0} تا {1} حرف وارد کنید."),
|
||||
range: $.validator.format("لطفا مقداری بین {0} تا {1} حرف وارد کنید."),
|
||||
max: $.validator.format("لطفا مقداری کمتر از {0} حرف وارد کنید."),
|
||||
min: $.validator.format("لطفا مقداری بیشتر از {0} حرف وارد کنید.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: FI (Finnish; suomi, suomen kieli)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Tämä kenttä on pakollinen.",
|
||||
email: "Syötä oikea sähköpostiosoite.",
|
||||
url: "Syötä oikea URL osoite.",
|
||||
date: "Syötä oike päivämäärä.",
|
||||
dateISO: "Syötä oike päivämäärä (VVVV-MM-DD).",
|
||||
number: "Syötä numero.",
|
||||
creditcard: "Syötä voimassa oleva luottokorttinumero.",
|
||||
digits: "Syötä pelkästään numeroita.",
|
||||
equalTo: "Syötä sama arvo uudestaan.",
|
||||
maxlength: $.validator.format("Voit syöttää enintään {0} merkkiä."),
|
||||
minlength: $.validator.format("Vähintään {0} merkkiä."),
|
||||
rangelength: $.validator.format("Syötä vähintään {0} ja enintään {1} merkkiä."),
|
||||
range: $.validator.format("Syötä arvo {0} ja {1} väliltä."),
|
||||
max: $.validator.format("Syötä arvo joka on pienempi tai yhtä suuri kuin {0}."),
|
||||
min: $.validator.format("Syötä arvo joka on yhtä suuri tai suurempi kuin {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: FR (French; français)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Ce champ est obligatoire.",
|
||||
remote: "Veuillez corriger ce champ.",
|
||||
email: "Veuillez fournir une adresse électronique valide.",
|
||||
url: "Veuillez fournir une adresse URL valide.",
|
||||
date: "Veuillez fournir une date valide.",
|
||||
dateISO: "Veuillez fournir une date valide (ISO).",
|
||||
number: "Veuillez fournir un numéro valide.",
|
||||
digits: "Veuillez fournir seulement des chiffres.",
|
||||
creditcard: "Veuillez fournir un numéro de carte de crédit valide.",
|
||||
equalTo: "Veuillez fournir encore la même valeur.",
|
||||
accept: "Veuillez fournir une valeur avec une extension valide.",
|
||||
maxlength: $.validator.format("Veuillez fournir au plus {0} caractères."),
|
||||
minlength: $.validator.format("Veuillez fournir au moins {0} caractères."),
|
||||
rangelength: $.validator.format("Veuillez fournir une valeur qui contient entre {0} et {1} caractères."),
|
||||
range: $.validator.format("Veuillez fournir une valeur entre {0} et {1}."),
|
||||
max: $.validator.format("Veuillez fournir une valeur inférieur ou égal à {0}."),
|
||||
min: $.validator.format("Veuillez fournir une valeur supérieur ou égal à {0}."),
|
||||
maxWords: $.validator.format("Veuillez fournir au plus {0} mots."),
|
||||
minWords: $.validator.format("Veuillez fournir au moins {0} mots."),
|
||||
rangeWords: $.validator.format("Veuillez fournir entre {0} et {1} mots."),
|
||||
letterswithbasicpunc: "Veuillez fournir seulement des lettres et des signes de ponctuation.",
|
||||
alphanumeric: "Veuillez fournir seulement des lettres, nombres, espaces et soulignages",
|
||||
lettersonly: "Veuillez fournir seulement des lettres.",
|
||||
nowhitespace: "Veuillez ne pas inscrire d'espaces blancs.",
|
||||
ziprange: "Veuillez fournir un code postal entre 902xx-xxxx et 905-xx-xxxx.",
|
||||
integer: "Veuillez fournir un nombre non décimal qui est positif ou négatif.",
|
||||
vinUS: "Veuillez fournir un numéro d'identification du véhicule (VIN).",
|
||||
dateITA: "Veuillez fournir une date valide.",
|
||||
time: "Veuillez fournir une heure valide entre 00:00 et 23:59.",
|
||||
phoneUS: "Veuillez fournir un numéro de téléphone valide.",
|
||||
phoneUK: "Veuillez fournir un numéro de téléphone valide.",
|
||||
mobileUK: "Veuillez fournir un numéro de téléphone mobile valide.",
|
||||
strippedminlength: $.validator.format("Veuillez fournir au moins {0} caractères."),
|
||||
email2: "Veuillez fournir une adresse électronique valide.",
|
||||
url2: "Veuillez fournir une adresse URL valide.",
|
||||
creditcardtypes: "Veuillez fournir un numéro de carte de crédit valide.",
|
||||
ipv4: "Veuillez fournir une adresse IP v4 valide.",
|
||||
ipv6: "Veuillez fournir une adresse IP v6 valide.",
|
||||
require_from_group: "Veuillez fournir au moins {0} de ces champs."
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: HE (Hebrew; עברית)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "השדה הזה הינו שדה חובה",
|
||||
remote: "נא לתקן שדה זה",
|
||||
email: "נא למלא כתובת דוא\"ל חוקית",
|
||||
url: "נא למלא כתובת אינטרנט חוקית",
|
||||
date: "נא למלא תאריך חוקי",
|
||||
dateISO: "נא למלא תאריך חוקי (ISO)",
|
||||
number: "נא למלא מספר",
|
||||
digits: "נא למלא רק מספרים",
|
||||
creditcard: "נא למלא מספר כרטיס אשראי חוקי",
|
||||
equalTo: "נא למלא את אותו ערך שוב",
|
||||
accept: "נא למלא ערך עם סיומת חוקית",
|
||||
maxlength: $.validator.format(".נא לא למלא יותר מ- {0} תווים"),
|
||||
minlength: $.validator.format("נא למלא לפחות {0} תווים"),
|
||||
rangelength: $.validator.format("נא למלא ערך בין {0} ל- {1} תווים"),
|
||||
range: $.validator.format("נא למלא ערך בין {0} ל- {1}"),
|
||||
max: $.validator.format("נא למלא ערך קטן או שווה ל- {0}"),
|
||||
min: $.validator.format("נא למלא ערך גדול או שווה ל- {0}")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: HR (Croatia; hrvatski jezik)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Ovo polje je obavezno.",
|
||||
remote: "Ovo polje treba popraviti.",
|
||||
email: "Unesite ispravnu e-mail adresu.",
|
||||
url: "Unesite ispravan URL.",
|
||||
date: "Unesite ispravan datum.",
|
||||
dateISO: "Unesite ispravan datum (ISO).",
|
||||
number: "Unesite ispravan broj.",
|
||||
digits: "Unesite samo brojeve.",
|
||||
creditcard: "Unesite ispravan broj kreditne kartice.",
|
||||
equalTo: "Unesite ponovo istu vrijednost.",
|
||||
accept: "Unesite vrijednost sa ispravnom ekstenzijom.",
|
||||
maxlength: $.validator.format("Maksimalni broj znakova je {0} ."),
|
||||
minlength: $.validator.format("Minimalni broj znakova je {0} ."),
|
||||
rangelength: $.validator.format("Unesite vrijednost između {0} i {1} znakova."),
|
||||
range: $.validator.format("Unesite vrijednost između {0} i {1}."),
|
||||
max: $.validator.format("Unesite vrijednost manju ili jednaku {0}."),
|
||||
min: $.validator.format("Unesite vrijednost veću ili jednaku {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: HU (Hungarian; Magyar)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Kötelező megadni.",
|
||||
maxlength: $.validator.format("Legfeljebb {0} karakter hosszú legyen."),
|
||||
minlength: $.validator.format("Legalább {0} karakter hosszú legyen."),
|
||||
rangelength: $.validator.format("Legalább {0} és legfeljebb {1} karakter hosszú legyen."),
|
||||
email: "Érvényes e-mail címnek kell lennie.",
|
||||
url: "Érvényes URL-nek kell lennie.",
|
||||
date: "Dátumnak kell lennie.",
|
||||
number: "Számnak kell lennie.",
|
||||
digits: "Csak számjegyek lehetnek.",
|
||||
equalTo: "Meg kell egyeznie a két értéknek.",
|
||||
range: $.validator.format("{0} és {1} közé kell esnie."),
|
||||
max: $.validator.format("Nem lehet nagyobb, mint {0}."),
|
||||
min: $.validator.format("Nem lehet kisebb, mint {0}."),
|
||||
creditcard: "Érvényes hitelkártyaszámnak kell lennie.",
|
||||
remote: "Kérem javítsa ki ezt a mezőt.",
|
||||
dateISO: "Kérem írjon be egy érvényes dátumot (ISO)."
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: IT (Italian; Italiano)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Campo obbligatorio.",
|
||||
remote: "Controlla questo campo.",
|
||||
email: "Inserisci un indirizzo email valido.",
|
||||
url: "Inserisci un indirizzo web valido.",
|
||||
date: "Inserisci una data valida.",
|
||||
dateISO: "Inserisci una data valida (ISO).",
|
||||
number: "Inserisci un numero valido.",
|
||||
digits: "Inserisci solo numeri.",
|
||||
creditcard: "Inserisci un numero di carta di credito valido.",
|
||||
equalTo: "Il valore non corrisponde.",
|
||||
accept: "Inserisci un valore con un'estensione valida.",
|
||||
maxlength: $.validator.format("Non inserire più di {0} caratteri."),
|
||||
minlength: $.validator.format("Inserisci almeno {0} caratteri."),
|
||||
rangelength: $.validator.format("Inserisci un valore compreso tra {0} e {1} caratteri."),
|
||||
range: $.validator.format("Inserisci un valore compreso tra {0} e {1}."),
|
||||
max: $.validator.format("Inserisci un valore minore o uguale a {0}."),
|
||||
min: $.validator.format("Inserisci un valore maggiore o uguale a {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: JA (Japanese; 日本語)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "このフィールドは必須です。",
|
||||
remote: "このフィールドを修正してください。",
|
||||
email: "有効なEメールアドレスを入力してください。",
|
||||
url: "有効なURLを入力してください。",
|
||||
date: "有効な日付を入力してください。",
|
||||
dateISO: "有効な日付(ISO)を入力してください。",
|
||||
number: "有効な数字を入力してください。",
|
||||
digits: "数字のみを入力してください。",
|
||||
creditcard: "有効なクレジットカード番号を入力してください。",
|
||||
equalTo: "同じ値をもう一度入力してください。",
|
||||
accept: "有効な拡張子を含む値を入力してください。",
|
||||
maxlength: $.format("{0} 文字以内で入力してください。"),
|
||||
minlength: $.format("{0} 文字以上で入力してください。"),
|
||||
rangelength: $.format("{0} 文字から {1} 文字までの値を入力してください。"),
|
||||
range: $.format("{0} から {1} までの値を入力してください。"),
|
||||
max: $.format("{0} 以下の値を入力してください。"),
|
||||
min: $.format("{0} 以上の値を入力してください。")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: KA (Georgian; ქართული)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "ამ ველის შევსება აუცილებელია.",
|
||||
remote: "გთხოვთ მიუთითოთ სწორი მნიშვნელობა.",
|
||||
email: "გთხოვთ მიუთითოთ ელ-ფოსტის კორექტული მისამართი.",
|
||||
url: "გთხოვთ მიუთითოთ კორექტული URL.",
|
||||
date: "გთხოვთ მიუთითოთ კორექტული თარიღი.",
|
||||
dateISO: "გთხოვთ მიუთითოთ კორექტული თარიღი ISO ფორმატში.",
|
||||
number: "გთხოვთ მიუთითოთ ციფრი.",
|
||||
digits: "გთხოვთ მიუთითოთ მხოლოდ ციფრები.",
|
||||
creditcard: "გთხოვთ მიუთითოთ საკრედიტო ბარათის კორექტული ნომერი.",
|
||||
equalTo: "გთხოვთ მიუთითოთ ასეთივე მნიშვნელობა კიდევ ერთხელ.",
|
||||
accept: "გთხოვთ აირჩიოთ ფაილი კორექტული გაფართოებით.",
|
||||
maxlength: $.validator.format("დასაშვებია არაუმეტეს {0} სიმბოლო."),
|
||||
minlength: $.validator.format("აუცილებელია შეიყვანოთ მინიმუმ {0} სიმბოლო."),
|
||||
rangelength: $.validator.format("ტექსტში სიმბოლოების რაოდენობა უნდა იყოს {0}-დან {1}-მდე."),
|
||||
range: $.validator.format("გთხოვთ შეიყვანოთ ციფრი {0}-დან {1}-მდე."),
|
||||
max: $.validator.format("გთხოვთ შეიყვანოთ ციფრი რომელიც ნაკლებია ან უდრის {0}-ს."),
|
||||
min: $.validator.format("გთხოვთ შეიყვანოთ ციფრი რომელიც მეტია ან უდრის {0}-ს.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: KK (Kazakh; қазақ тілі)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Бұл өрісті міндетті түрде толтырыңыз.",
|
||||
remote: "Дұрыс мағына енгізуіңізді сұраймыз.",
|
||||
email: "Нақты электронды поштаңызды енгізуіңізді сұраймыз.",
|
||||
url: "Нақты URL-ды енгізуіңізді сұраймыз.",
|
||||
date: "Нақты URL-ды енгізуіңізді сұраймыз.",
|
||||
dateISO: "Нақты ISO форматымен сәйкес датасын енгізуіңізді сұраймыз.",
|
||||
number: "Күнді енгізуіңізді сұраймыз.",
|
||||
digits: "Тек қана сандарды енгізуіңізді сұраймыз.",
|
||||
creditcard: "Несие картасының нөмірін дұрыс енгізуіңізді сұраймыз.",
|
||||
equalTo: "Осы мәнді қайта енгізуіңізді сұраймыз.",
|
||||
accept: "Файлдың кеңейтуін дұрыс таңдаңыз.",
|
||||
maxlength: $.format("Ұзындығы {0} символдан көр болмасын."),
|
||||
minlength: $.format("Ұзындығы {0} символдан аз болмасын."),
|
||||
rangelength: $.format("Ұзындығы {0}-{1} дейін мән енгізуіңізді сұраймыз."),
|
||||
range: $.format("Пожалуйста, введите число от {0} до {1}. - {0} - {1} санын енгізуіңізді сұраймыз."),
|
||||
max: $.format("{0} аз немесе тең санын енгізуіңіді сұраймыз."),
|
||||
min: $.format("{0} көп немесе тең санын енгізуіңізді сұраймыз.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: KO (Korean; 한국어)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "필수 항목입니다.",
|
||||
remote: "항목을 수정하세요.",
|
||||
email: "유효하지 않은 E-Mail주소입니다.",
|
||||
url: "유효하지 않은 주소입니다.",
|
||||
date: "옳바른 날짜를 입력하세요.",
|
||||
dateISO: "옳바른 날짜(ISO)를 입력하세요.",
|
||||
number: "유효한 숫자가 아닙니다.",
|
||||
digits: "숫자만 입력 가능합니다.",
|
||||
creditcard: "신용카드번호가 바르지 않습니다.",
|
||||
equalTo: "같은값을 다시 입력하세요.",
|
||||
accept: "옳바른 확장자가 아닙니다.",
|
||||
maxlength: $.format("{0}자를 넘을 수 없습니다. "),
|
||||
minlength: $.format("{0}자 이하로 입력하세요."),
|
||||
rangelength: $.format("문자 길이를 {0} 에서 {1} 사이의로 입력하세요."),
|
||||
range: $.format("{0} 에서 {1} 값을 입력하세요."),
|
||||
max: $.format("{0} 이하의 값을 입력하세요."),
|
||||
min: $.format("{0} 이상의 값을 입력하세요.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: LT (Lithuanian; lietuvių kalba)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Šis laukas yra privalomas.",
|
||||
remote: "Prašau pataisyti šį lauką.",
|
||||
email: "Prašau įvesti teisingą elektroninio pašto adresą.",
|
||||
url: "Prašau įvesti teisingą URL.",
|
||||
date: "Prašau įvesti teisingą datą.",
|
||||
dateISO: "Prašau įvesti teisingą datą (ISO).",
|
||||
number: "Prašau įvesti teisingą skaičių.",
|
||||
digits: "Prašau naudoti tik skaitmenis.",
|
||||
creditcard: "Prašau įvesti teisingą kreditinės kortelės numerį.",
|
||||
equalTo: "Prašau įvestį tą pačią reikšmę dar kartą.",
|
||||
accept: "Prašau įvesti reikšmę su teisingu plėtiniu.",
|
||||
maxlength: $.format("Prašau įvesti ne daugiau kaip {0} simbolių."),
|
||||
minlength: $.format("Prašau įvesti bent {0} simbolius."),
|
||||
rangelength: $.format("Prašau įvesti reikšmes, kurių ilgis nuo {0} iki {1} simbolių."),
|
||||
range: $.format("Prašau įvesti reikšmę intervale nuo {0} iki {1}."),
|
||||
max: $.format("Prašau įvesti reikšmę mažesnę arba lygią {0}."),
|
||||
min: $.format("Prašau įvesti reikšmę didesnę arba lygią {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: LV (Latvian; latviešu valoda)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Šis lauks ir obligāts.",
|
||||
remote: "Lūdzu, pārbaudiet šo lauku.",
|
||||
email: "Lūdzu, ievadiet derīgu e-pasta adresi.",
|
||||
url: "Lūdzu, ievadiet derīgu URL adresi.",
|
||||
date: "Lūdzu, ievadiet derīgu datumu.",
|
||||
dateISO: "Lūdzu, ievadiet derīgu datumu (ISO).",
|
||||
number: "Lūdzu, ievadiet derīgu numuru.",
|
||||
digits: "Lūdzu, ievadiet tikai ciparus.",
|
||||
creditcard: "Lūdzu, ievadiet derīgu kredītkartes numuru.",
|
||||
equalTo: "Lūdzu, ievadiet to pašu vēlreiz.",
|
||||
accept: "Lūdzu, ievadiet vērtību ar derīgu paplašinājumu.",
|
||||
maxlength: $.validator.format("Lūdzu, ievadiet ne vairāk kā {0} rakstzīmes."),
|
||||
minlength: $.validator.format("Lūdzu, ievadiet vismaz {0} rakstzīmes."),
|
||||
rangelength: $.validator.format("Lūdzu ievadiet {0} līdz {1} rakstzīmes."),
|
||||
range: $.validator.format("Lūdzu, ievadiet skaitli no {0} līdz {1}."),
|
||||
max: $.validator.format("Lūdzu, ievadiet skaitli, kurš ir mazāks vai vienāds ar {0}."),
|
||||
min: $.validator.format("Lūdzu, ievadiet skaitli, kurš ir lielāks vai vienāds ar {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: MY (Malay; Melayu)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Medan ini diperlukan.",
|
||||
remote: "Sila betulkan medan ini.",
|
||||
email: "Sila masukkan alamat emel yang betul.",
|
||||
url: "Sila masukkan URL yang betul.",
|
||||
date: "Sila masukkan tarikh yang betul.",
|
||||
dateISO: "Sila masukkan tarikh(ISO) yang betul.",
|
||||
number: "Sila masukkan nombor yang betul.",
|
||||
digits: "Sila masukkan nilai digit sahaja.",
|
||||
creditcard: "Sila masukkan nombor kredit kad yang betul.",
|
||||
equalTo: "Sila masukkan nilai yang sama semula.",
|
||||
accept: "Sila masukkan nilai yang telah diterima.",
|
||||
maxlength: $.validator.format("Sila masukkan nilai tidak lebih dari {0} aksara."),
|
||||
minlength: $.validator.format("Sila masukkan nilai sekurang-kurangnya {0} aksara."),
|
||||
rangelength: $.validator.format("Sila masukkan panjang nilai antara {0} dan {1} aksara."),
|
||||
range: $.validator.format("Sila masukkan nilai antara {0} dan {1} aksara."),
|
||||
max: $.validator.format("Sila masukkan nilai yang kurang atau sama dengan {0}."),
|
||||
min: $.validator.format("Sila masukkan nilai yang lebih atau sama dengan {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: NL (Dutch; Nederlands, Vlaams)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Dit is een verplicht veld.",
|
||||
remote: "Controleer dit veld.",
|
||||
email: "Vul hier een geldig e-mailadres in.",
|
||||
url: "Vul hier een geldige URL in.",
|
||||
date: "Vul hier een geldige datum in.",
|
||||
dateISO: "Vul hier een geldige datum in (ISO-formaat).",
|
||||
number: "Vul hier een geldig getal in.",
|
||||
digits: "Vul hier alleen getallen in.",
|
||||
creditcard: "Vul hier een geldig creditcardnummer in.",
|
||||
equalTo: "Vul hier dezelfde waarde in.",
|
||||
accept: "Vul hier een waarde in met een geldige extensie.",
|
||||
maxlength: $.validator.format("Vul hier maximaal {0} tekens in."),
|
||||
minlength: $.validator.format("Vul hier minimaal {0} tekens in."),
|
||||
rangelength: $.validator.format("Vul hier een waarde in van minimaal {0} en maximaal {1} tekens."),
|
||||
range: $.validator.format("Vul hier een waarde in van minimaal {0} en maximaal {1}."),
|
||||
max: $.validator.format("Vul hier een waarde in kleiner dan of gelijk aan {0}."),
|
||||
min: $.validator.format("Vul hier een waarde in groter dan of gelijk aan {0}."),
|
||||
|
||||
// for validations in additional-methods.js
|
||||
iban: "Vul hier een geldig IBAN in.",
|
||||
dateNL: "Vul hier een geldige datum in.",
|
||||
phoneNL: "Vul hier een geldig Nederlands telefoonnummer in.",
|
||||
mobileNL: "Vul hier een geldig Nederlands mobiel telefoonnummer in.",
|
||||
postalcodeNL: "Vul hier een geldige postcode in.",
|
||||
bankaccountNL: "Vul hier een geldig bankrekeningnummer in.",
|
||||
giroaccountNL: "Vul hier een geldig gironummer in.",
|
||||
bankorgiroaccountNL: "Vul hier een geldig bank- of gironummer in."
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: NO (Norwegian; Norsk)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Dette feltet er obligatorisk.",
|
||||
maxlength: $.validator.format("Maksimalt {0} tegn."),
|
||||
minlength: $.validator.format("Minimum {0} tegn."),
|
||||
rangelength: $.validator.format("Angi minimum {0} og maksimum {1} tegn."),
|
||||
email: "Oppgi en gyldig epostadresse.",
|
||||
url: "Angi en gyldig URL.",
|
||||
date: "Angi en gyldig dato.",
|
||||
dateISO: "Angi en gyldig dato (&ARING;&ARING;&ARING;&ARING;-MM-DD).",
|
||||
dateSE: "Angi en gyldig dato.",
|
||||
number: "Angi et gyldig nummer.",
|
||||
numberSE: "Angi et gyldig nummer.",
|
||||
digits: "Skriv kun tall.",
|
||||
equalTo: "Skriv samme verdi igjen.",
|
||||
range: $.validator.format("Angi en verdi mellom {0} og {1}."),
|
||||
max: $.validator.format("Angi en verdi som er mindre eller lik {0}."),
|
||||
min: $.validator.format("Angi en verdi som er større eller lik {0}."),
|
||||
creditcard: "Angi et gyldig kredittkortnummer."
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: PL (Polish; język polski, polszczyzna)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "To pole jest wymagane.",
|
||||
remote: "Proszę o wypełnienie tego pola.",
|
||||
email: "Proszę o podanie prawidłowego adresu email.",
|
||||
url: "Proszę o podanie prawidłowego URL.",
|
||||
date: "Proszę o podanie prawidłowej daty.",
|
||||
dateISO: "Proszę o podanie prawidłowej daty (ISO).",
|
||||
number: "Proszę o podanie prawidłowej liczby.",
|
||||
digits: "Proszę o podanie samych cyfr.",
|
||||
creditcard: "Proszę o podanie prawidłowej karty kredytowej.",
|
||||
equalTo: "Proszę o podanie tej samej wartości ponownie.",
|
||||
accept: "Proszę o podanie wartości z prawidłowym rozszerzeniem.",
|
||||
maxlength: $.validator.format("Proszę o podanie nie więcej niż {0} znaków."),
|
||||
minlength: $.validator.format("Proszę o podanie przynajmniej {0} znaków."),
|
||||
rangelength: $.validator.format("Proszę o podanie wartości o długości od {0} do {1} znaków."),
|
||||
range: $.validator.format("Proszę o podanie wartości z przedziału od {0} do {1}."),
|
||||
max: $.validator.format("Proszę o podanie wartości mniejszej bądź równej {0}."),
|
||||
min: $.validator.format("Proszę o podanie wartości większej bądź równej {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: PT (Portuguese; português)
|
||||
* Region: BR (Brazil)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Este campo é requerido.",
|
||||
remote: "Por favor, corrija este campo.",
|
||||
email: "Por favor, forneça um endereço eletrônico válido.",
|
||||
url: "Por favor, forneça uma URL válida.",
|
||||
date: "Por favor, forneça uma data válida.",
|
||||
dateISO: "Por favor, forneça uma data válida (ISO).",
|
||||
number: "Por favor, forneça um número válido.",
|
||||
digits: "Por favor, forneça somente dígitos.",
|
||||
creditcard: "Por favor, forneça um cartão de crédito válido.",
|
||||
equalTo: "Por favor, forneça o mesmo valor novamente.",
|
||||
accept: "Por favor, forneça um valor com uma extensão válida.",
|
||||
maxlength: $.validator.format("Por favor, forneça não mais que {0} caracteres."),
|
||||
minlength: $.validator.format("Por favor, forneça ao menos {0} caracteres."),
|
||||
rangelength: $.validator.format("Por favor, forneça um valor entre {0} e {1} caracteres de comprimento."),
|
||||
range: $.validator.format("Por favor, forneça um valor entre {0} e {1}."),
|
||||
max: $.validator.format("Por favor, forneça um valor menor ou igual a {0}."),
|
||||
min: $.validator.format("Por favor, forneça um valor maior ou igual a {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: PT (Portuguese; português)
|
||||
* Region: PT (Portugal)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Campo de preenchimento obrigatório.",
|
||||
remote: "Por favor, corrija este campo.",
|
||||
email: "Por favor, introduza um endereço eletrónico válido.",
|
||||
url: "Por favor, introduza um URL válido.",
|
||||
date: "Por favor, introduza uma data válida.",
|
||||
dateISO: "Por favor, introduza uma data válida (ISO).",
|
||||
number: "Por favor, introduza um número válido.",
|
||||
digits: "Por favor, introduza apenas dígitos.",
|
||||
creditcard: "Por favor, introduza um número de cartão de crédito válido.",
|
||||
equalTo: "Por favor, introduza de novo o mesmo valor.",
|
||||
accept: "Por favor, introduza um ficheiro com uma extensão válida.",
|
||||
maxlength: $.validator.format("Por favor, não introduza mais do que {0} caracteres."),
|
||||
minlength: $.validator.format("Por favor, introduza pelo menos {0} caracteres."),
|
||||
rangelength: $.validator.format("Por favor, introduza entre {0} e {1} caracteres."),
|
||||
range: $.validator.format("Por favor, introduza um valor entre {0} e {1}."),
|
||||
max: $.validator.format("Por favor, introduza um valor menor ou igual a {0}."),
|
||||
min: $.validator.format("Por favor, introduza um valor maior ou igual a {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: RO (Romanian, limba română)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Acest câmp este obligatoriu.",
|
||||
remote: "Te rugăm să completezi acest câmp.",
|
||||
email: "Te rugăm să introduci o adresă de email validă",
|
||||
url: "Te rugăm sa introduci o adresă URL validă.",
|
||||
date: "Te rugăm să introduci o dată corectă.",
|
||||
dateISO: "Te rugăm să introduci o dată (ISO) corectă.",
|
||||
number: "Te rugăm să introduci un număr întreg valid.",
|
||||
digits: "Te rugăm să introduci doar cifre.",
|
||||
creditcard: "Te rugăm să introduci un numar de carte de credit valid.",
|
||||
equalTo: "Te rugăm să reintroduci valoarea.",
|
||||
accept: "Te rugăm să introduci o valoare cu o extensie validă.",
|
||||
maxlength: $.validator.format("Te rugăm să nu introduci mai mult de {0} caractere."),
|
||||
minlength: $.validator.format("Te rugăm să introduci cel puțin {0} caractere."),
|
||||
rangelength: $.validator.format("Te rugăm să introduci o valoare între {0} și {1} caractere."),
|
||||
range: $.validator.format("Te rugăm să introduci o valoare între {0} și {1}."),
|
||||
max: $.validator.format("Te rugăm să introduci o valoare egal sau mai mică decât {0}."),
|
||||
min: $.validator.format("Te rugăm să introduci o valoare egal sau mai mare decât {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: RU (Russian; русский язык)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Это поле необходимо заполнить.",
|
||||
remote: "Пожалуйста, введите правильное значение.",
|
||||
email: "Пожалуйста, введите корректный адрес электронной почты.",
|
||||
url: "Пожалуйста, введите корректный URL.",
|
||||
date: "Пожалуйста, введите корректную дату.",
|
||||
dateISO: "Пожалуйста, введите корректную дату в формате ISO.",
|
||||
number: "Пожалуйста, введите число.",
|
||||
digits: "Пожалуйста, вводите только цифры.",
|
||||
creditcard: "Пожалуйста, введите правильный номер кредитной карты.",
|
||||
equalTo: "Пожалуйста, введите такое же значение ещё раз.",
|
||||
accept: "Пожалуйста, выберите файл с правильным расширением.",
|
||||
maxlength: $.validator.format("Пожалуйста, введите не больше {0} символов."),
|
||||
minlength: $.validator.format("Пожалуйста, введите не меньше {0} символов."),
|
||||
rangelength: $.validator.format("Пожалуйста, введите значение длиной от {0} до {1} символов."),
|
||||
range: $.validator.format("Пожалуйста, введите число от {0} до {1}."),
|
||||
max: $.validator.format("Пожалуйста, введите число, меньшее или равное {0}."),
|
||||
min: $.validator.format("Пожалуйста, введите число, большее или равное {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: SI (Slovenian)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "To polje je obvezno.",
|
||||
remote: "Vpis v tem polju ni v pravi obliki.",
|
||||
email: "Prosimo, vnesite pravi email naslov.",
|
||||
url: "Prosimo, vnesite pravi URL.",
|
||||
date: "Prosimo, vnesite pravi datum.",
|
||||
dateISO: "Prosimo, vnesite pravi datum (ISO).",
|
||||
number: "Prosimo, vnesite pravo številko.",
|
||||
digits: "Prosimo, vnesite samo številke.",
|
||||
creditcard: "Prosimo, vnesite pravo številko kreditne kartice.",
|
||||
equalTo: "Prosimo, ponovno vnesite enako vsebino.",
|
||||
accept: "Prosimo, vnesite vsebino z pravo končnico.",
|
||||
maxlength: $.validator.format("Prosimo, da ne vnašate več kot {0} znakov."),
|
||||
minlength: $.validator.format("Prosimo, vnesite vsaj {0} znakov."),
|
||||
rangelength: $.validator.format("Prosimo, vnesite od {0} do {1} znakov."),
|
||||
range: $.validator.format("Prosimo, vnesite vrednost med {0} in {1}."),
|
||||
max: $.validator.format("Prosimo, vnesite vrednost manjšo ali enako {0}."),
|
||||
min: $.validator.format("Prosimo, vnesite vrednost večjo ali enako {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: SK (Slovak; slovenčina, slovenský jazyk)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Povinné zadať.",
|
||||
maxlength: $.validator.format("Maximálne {0} znakov."),
|
||||
minlength: $.validator.format("Minimálne {0} znakov."),
|
||||
rangelength: $.validator.format("Minimálne {0} a Maximálne {0} znakov."),
|
||||
email: "E-mailová adresa musí byť platná.",
|
||||
url: "URL musí byť platný.",
|
||||
date: "Musí byť dátum.",
|
||||
number: "Musí byť číslo.",
|
||||
digits: "Môže obsahovať iba číslice.",
|
||||
equalTo: "Dva hodnoty sa musia rovnať.",
|
||||
range: $.validator.format("Musí byť medzi {0} a {1}."),
|
||||
max: $.validator.format("Nemôže byť viac ako{0}."),
|
||||
min: $.validator.format("Nemôže byť menej ako{0}."),
|
||||
creditcard: "Číslo platobnej karty musí byť platné."
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Language: SL (Slovenian; slovenski jezik)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "To polje je obvezno.",
|
||||
remote: "Prosimo popravite to polje.",
|
||||
email: "Prosimo vnesite veljaven email naslov.",
|
||||
url: "Prosimo vnesite veljaven URL naslov.",
|
||||
date: "Prosimo vnesite veljaven datum.",
|
||||
dateISO: "Prosimo vnesite veljaven ISO datum.",
|
||||
number: "Prosimo vnesite veljavno število.",
|
||||
digits: "Prosimo vnesite samo števila.",
|
||||
creditcard: "Prosimo vnesite veljavno številko kreditne kartice.",
|
||||
equalTo: "Prosimo ponovno vnesite vrednost.",
|
||||
accept: "Prosimo vnesite vrednost z veljavno končnico.",
|
||||
maxlength: $.validator.format("Prosimo vnesite največ {0} znakov."),
|
||||
minlength: $.validator.format("Prosimo vnesite najmanj {0} znakov."),
|
||||
rangelength: $.validator.format("Prosimo vnesite najmanj {0} in največ {1} znakov."),
|
||||
range: $.validator.format("Prosimo vnesite vrednost med {0} in {1}."),
|
||||
max: $.validator.format("Prosimo vnesite vrednost manjše ali enako {0}."),
|
||||
min: $.validator.format("Prosimo vnesite vrednost večje ali enako {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: SR (Serbian; српски језик)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Поље је обавезно.",
|
||||
remote: "Средите ово поље.",
|
||||
email: "Унесите исправну и-мејл адресу",
|
||||
url: "Унесите исправан URL.",
|
||||
date: "Унесите исправан датум.",
|
||||
dateISO: "Унесите исправан датум (ISO).",
|
||||
number: "Унесите исправан број.",
|
||||
digits: "Унесите само цифе.",
|
||||
creditcard: "Унесите исправан број кредитне картице.",
|
||||
equalTo: "Унесите исту вредност поново.",
|
||||
accept: "Унесите вредност са одговарајућом екстензијом.",
|
||||
maxlength: $.validator.format("Унесите мање од {0}карактера."),
|
||||
minlength: $.validator.format("Унесите барем {0} карактера."),
|
||||
rangelength: $.validator.format("Унесите вредност дугачку између {0} и {1} карактера."),
|
||||
range: $.validator.format("Унесите вредност између {0} и {1}."),
|
||||
max: $.validator.format("Унесите вредност мању или једнаку {0}."),
|
||||
min: $.validator.format("Унесите вредност већу или једнаку {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: SV (Swedish; Svenska)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Detta fält är obligatoriskt.",
|
||||
maxlength: $.validator.format("Du får ange högst {0} tecken."),
|
||||
minlength: $.validator.format("Du måste ange minst {0} tecken."),
|
||||
rangelength: $.validator.format("Ange minst {0} och max {1} tecken."),
|
||||
email: "Ange en korrekt e-postadress.",
|
||||
url: "Ange en korrekt URL.",
|
||||
date: "Ange ett korrekt datum.",
|
||||
dateISO: "Ange ett korrekt datum (ÅÅÅÅ-MM-DD).",
|
||||
number: "Ange ett korrekt nummer.",
|
||||
digits: "Ange endast siffror.",
|
||||
equalTo: "Ange samma värde igen.",
|
||||
range: $.validator.format("Ange ett värde mellan {0} och {1}."),
|
||||
max: $.validator.format("Ange ett värde som är mindre eller lika med {0}."),
|
||||
min: $.validator.format("Ange ett värde som är större eller lika med {0}."),
|
||||
creditcard: "Ange ett korrekt kreditkortsnummer."
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: TH (Thai; ไทย)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "โปรดระบุ",
|
||||
remote: "โปรดแก้ไขให้ถูกต้อง",
|
||||
email: "โปรดระบุที่อยู่อีเมล์ที่ถูกต้อง",
|
||||
url: "โปรดระบุ URL ที่ถูกต้อง",
|
||||
date: "โปรดระบุวันที่ ที่ถูกต้อง",
|
||||
dateISO: "โปรดระบุวันที่ ที่ถูกต้อง (ระบบ ISO).",
|
||||
number: "โปรดระบุทศนิยมที่ถูกต้อง",
|
||||
digits: "โปรดระบุจำนวนเต็มที่ถูกต้อง",
|
||||
creditcard: "โปรดระบุรหัสบัตรเครดิตที่ถูกต้อง",
|
||||
equalTo: "โปรดระบุค่าเดิมอีกครั้ง",
|
||||
accept: "โปรดระบุค่าที่มีส่วนขยายที่ถูกต้อง",
|
||||
maxlength: $.validator.format("โปรดอย่าระบุค่าที่ยาวกว่า {0} อักขระ"),
|
||||
minlength: $.validator.format("โปรดอย่าระบุค่าที่สั้นกว่า {0} อักขระ"),
|
||||
rangelength: $.validator.format("โปรดอย่าระบุค่าความยาวระหว่าง {0} ถึง {1} อักขระ"),
|
||||
range: $.validator.format("โปรดระบุค่าระหว่าง {0} และ {1}"),
|
||||
max: $.validator.format("โปรดระบุค่าน้อยกว่าหรือเท่ากับ {0}"),
|
||||
min: $.validator.format("โปรดระบุค่ามากกว่าหรือเท่ากับ {0}")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: TR (Turkish; Türkçe)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Bu alanın doldurulması zorunludur.",
|
||||
remote: "Lütfen bu alanı düzeltin.",
|
||||
email: "Lütfen geçerli bir e-posta adresi giriniz.",
|
||||
url: "Lütfen geçerli bir web adresi (URL) giriniz.",
|
||||
date: "Lütfen geçerli bir tarih giriniz.",
|
||||
dateISO: "Lütfen geçerli bir tarih giriniz(ISO formatında)",
|
||||
number: "Lütfen geçerli bir sayı giriniz.",
|
||||
digits: "Lütfen sadece sayısal karakterler giriniz.",
|
||||
creditcard: "Lütfen geçerli bir kredi kartı giriniz.",
|
||||
equalTo: "Lütfen aynı değeri tekrar giriniz.",
|
||||
accept: "Lütfen geçerli uzantıya sahip bir değer giriniz.",
|
||||
maxlength: $.validator.format("Lütfen en fazla {0} karakter uzunluğunda bir değer giriniz."),
|
||||
minlength: $.validator.format("Lütfen en az {0} karakter uzunluğunda bir değer giriniz."),
|
||||
rangelength: $.validator.format("Lütfen en az {0} ve en fazla {1} uzunluğunda bir değer giriniz."),
|
||||
range: $.validator.format("Lütfen {0} ile {1} arasında bir değer giriniz."),
|
||||
max: $.validator.format("Lütfen {0} değerine eşit ya da daha küçük bir değer giriniz."),
|
||||
min: $.validator.format("Lütfen {0} değerine eşit ya da daha büyük bir değer giriniz.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: UK (Ukrainian; українська мова)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Це поле необхідно заповнити.",
|
||||
remote: "Будь ласка, введіть правильне значення.",
|
||||
email: "Будь ласка, введіть коректну адресу електронної пошти.",
|
||||
url: "Будь ласка, введіть коректний URL.",
|
||||
date: "Будь ласка, введіть коректну дату.",
|
||||
dateISO: "Будь ласка, введіть коректну дату у форматі ISO.",
|
||||
number: "Будь ласка, введіть число.",
|
||||
digits: "Вводите потрібно лише цифри.",
|
||||
creditcard: "Будь ласка, введіть правильний номер кредитної карти.",
|
||||
equalTo: "Будь ласка, введіть таке ж значення ще раз.",
|
||||
accept: "Будь ласка, виберіть файл з правильним розширенням.",
|
||||
maxlength: $.validator.format("Будь ласка, введіть не більше {0} символів."),
|
||||
minlength: $.validator.format("Будь ласка, введіть не менше {0} символів."),
|
||||
rangelength: $.validator.format("Будь ласка, введіть значення довжиною від {0} до {1} символів."),
|
||||
range: $.validator.format("Будь ласка, введіть число від {0} до {1}."),
|
||||
max: $.validator.format("Будь ласка, введіть число, менше або рівно {0}."),
|
||||
min: $.validator.format("Будь ласка, введіть число, більше або рівно {0}.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: VI (Vietnamese; Tiếng Việt)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "Hãy nhập.",
|
||||
remote: "Hãy sửa cho đúng.",
|
||||
email: "Hãy nhập email.",
|
||||
url: "Hãy nhập URL.",
|
||||
date: "Hãy nhập ngày.",
|
||||
dateISO: "Hãy nhập ngày (ISO).",
|
||||
number: "Hãy nhập số.",
|
||||
digits: "Hãy nhập chữ số.",
|
||||
creditcard: "Hãy nhập số thẻ tín dụng.",
|
||||
equalTo: "Hãy nhập thêm lần nữa.",
|
||||
accept: "Phần mở rộng không đúng.",
|
||||
maxlength: $.format("Hãy nhập từ {0} kí tự trở xuống."),
|
||||
minlength: $.format("Hãy nhập từ {0} kí tự trở lên."),
|
||||
rangelength: $.format("Hãy nhập từ {0} đến {1} kí tự."),
|
||||
range: $.format("Hãy nhập từ {0} đến {1}."),
|
||||
max: $.format("Hãy nhập từ {0} trở xuống."),
|
||||
min: $.format("Hãy nhập từ {1} trở lên.")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: ZH (Chinese, 中文 (Zhōngwén), 汉语, 漢語)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "必选字段",
|
||||
remote: "请修正该字段",
|
||||
email: "请输入正确格式的电子邮件",
|
||||
url: "请输入合法的网址",
|
||||
date: "请输入合法的日期",
|
||||
dateISO: "请输入合法的日期 (ISO).",
|
||||
number: "请输入合法的数字",
|
||||
digits: "只能输入整数",
|
||||
creditcard: "请输入合法的信用卡号",
|
||||
equalTo: "请再次输入相同的值",
|
||||
accept: "请输入拥有合法后缀名的字符串",
|
||||
maxlength: $.validator.format("请输入一个长度最多是 {0} 的字符串"),
|
||||
minlength: $.validator.format("请输入一个长度最少是 {0} 的字符串"),
|
||||
rangelength: $.validator.format("请输入一个长度介于 {0} 和 {1} 之间的字符串"),
|
||||
range: $.validator.format("请输入一个介于 {0} 和 {1} 之间的值"),
|
||||
max: $.validator.format("请输入一个最大为 {0} 的值"),
|
||||
min: $.validator.format("请输入一个最小为 {0} 的值")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Translated default messages for the jQuery validation plugin.
|
||||
* Locale: ZH (Chinese; 中文 (Zhōngwén), 汉语, 漢語)
|
||||
* Region: TW (Taiwan)
|
||||
*/
|
||||
(function ($) {
|
||||
$.extend($.validator.messages, {
|
||||
required: "必填",
|
||||
remote: "請修正此欄位",
|
||||
email: "請輸入正確的電子信箱",
|
||||
url: "請輸入合法的URL",
|
||||
date: "請輸入合法的日期",
|
||||
dateISO: "請輸入合法的日期 (ISO).",
|
||||
number: "請輸入數字",
|
||||
digits: "請輸入整數",
|
||||
creditcard: "請輸入合法的信用卡號碼",
|
||||
equalTo: "請重複輸入一次",
|
||||
accept: "請輸入有效的後缀字串",
|
||||
maxlength: $.validator.format("請輸入長度不大於{0} 的字串"),
|
||||
minlength: $.validator.format("請輸入長度不小於 {0} 的字串"),
|
||||
rangelength: $.validator.format("請輸入長度介於 {0} 和 {1} 之間的字串"),
|
||||
range: $.validator.format("請輸入介於 {0} 和 {1} 之間的數值"),
|
||||
max: $.validator.format("請輸入不大於 {0} 的數值"),
|
||||
min: $.validator.format("請輸入不小於 {0} 的數值")
|
||||
});
|
||||
}(jQuery));
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* Localized default methods for the jQuery validation plugin.
|
||||
* Locale: DE
|
||||
*/
|
||||
jQuery.extend(jQuery.validator.methods, {
|
||||
date: function(value, element) {
|
||||
return this.optional(element) || /^\d\d?\.\d\d?\.\d\d\d?\d?$/.test(value);
|
||||
},
|
||||
number: function(value, element) {
|
||||
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Localized default methods for the jQuery validation plugin.
|
||||
* Locale: NL
|
||||
*/
|
||||
jQuery.extend(jQuery.validator.methods, {
|
||||
date: function(value, element) {
|
||||
return this.optional(element) || /^\d\d?[\.\/\-]\d\d?[\.\/\-]\d\d\d?\d?$/.test(value);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
* Localized default methods for the jQuery validation plugin.
|
||||
* Locale: PT_BR
|
||||
*/
|
||||
jQuery.extend(jQuery.validator.methods, {
|
||||
date: function(value, element) {
|
||||
return this.optional(element) || /^\d\d?\/\d\d?\/\d\d\d?\d?$/.test(value);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "jquery-validation",
|
||||
"title": "jQuery Validation Plugin",
|
||||
"description": "Form validation made easy",
|
||||
"version": "1.11.0",
|
||||
"homepage": "https://github.com/jzaefferer/jquery-validation",
|
||||
"author": {
|
||||
"name": "Jörn Zaefferer",
|
||||
"email": "joern.zaefferer@gmail.com",
|
||||
"url": "http://bassistance.de"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/jzaefferer/jquery-validation.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/jzaefferer/jquery-validation/issues"
|
||||
},
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://www.opensource.org/licenses/MIT"
|
||||
}
|
||||
],
|
||||
"scripts": {
|
||||
"test": "grunt lint qunit"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"grunt": "0.3.x",
|
||||
"zipstream": "0.2.x"
|
||||
},
|
||||
"keywords": [
|
||||
"forms",
|
||||
"validation",
|
||||
"validate"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="firebug/firebug.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
var handler = {
|
||||
focusin: function() {
|
||||
$(this).addClass("focus");
|
||||
},
|
||||
focusout: function() {
|
||||
$(this).removeClass("focus");
|
||||
}
|
||||
}
|
||||
$("#commentForm").delegate("focusin focusout", ":text, textarea", function(event) {
|
||||
/*
|
||||
this.addClass("focus").one("blur", function() {
|
||||
$(this).removeClass("focus");
|
||||
});
|
||||
*/
|
||||
handler[event.type].call(this, arguments);
|
||||
});
|
||||
$("#remove").click(function() {
|
||||
$("#commentForm").unbind("focusin");
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#commentForm { width: 500px; }
|
||||
#commentForm label { width: 250px; display: block; float: left; }
|
||||
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
|
||||
.focus { background-color: red; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>A simple comment form with submit validation and default messages</legend>
|
||||
<p>
|
||||
<label for="cname">Name (required, at least 2 characters)</label>
|
||||
<input id="cname" name="name" class="some other styles {required:true,minLength:2}" />
|
||||
<p>
|
||||
<label for="cemail">E-Mail (required)</label>
|
||||
<input id="cemail" name="email" class="{required:true,email:true}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl">URL (optional)</label>
|
||||
<input id="curl" name="url" class="{url:true}" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment">Your comment (required)</label>
|
||||
<textarea id="ccomment" name="comment" class="{required:true}"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<button id="remove">Remove focus handler</button>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 457 B |
@@ -0,0 +1,209 @@
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
background: #FFFFFF;
|
||||
font-family: Lucida Grande, Tahoma, sans-serif;
|
||||
font-size: 11px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.toolbar {
|
||||
height: 14px;
|
||||
border-top: 1px solid ThreeDHighlight;
|
||||
border-bottom: 1px solid ThreeDShadow;
|
||||
padding: 2px 6px;
|
||||
background: ThreeDFace;
|
||||
}
|
||||
|
||||
.toolbarRight {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 6px;
|
||||
}
|
||||
|
||||
#log {
|
||||
overflow: auto;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#commandLine {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 18px;
|
||||
border: none;
|
||||
border-top: 1px solid ThreeDShadow;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.logRow {
|
||||
position: relative;
|
||||
border-bottom: 1px solid #D7D7D7;
|
||||
padding: 2px 4px 1px 6px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
.logRow-command {
|
||||
font-family: Monaco, monospace;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.objectBox-null {
|
||||
padding: 0 2px;
|
||||
border: 1px solid #666666;
|
||||
background-color: #888888;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.objectBox-string {
|
||||
font-family: Monaco, monospace;
|
||||
color: red;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.objectBox-number {
|
||||
color: #000088;
|
||||
}
|
||||
|
||||
.objectBox-function {
|
||||
font-family: Monaco, monospace;
|
||||
color: DarkGreen;
|
||||
}
|
||||
|
||||
.objectBox-object {
|
||||
color: DarkGreen;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.logRow-info,
|
||||
.logRow-error,
|
||||
.logRow-warning {
|
||||
background: #FFFFFF no-repeat 2px 2px;
|
||||
padding-left: 20px;
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
|
||||
.logRow-info {
|
||||
background-image: url(infoIcon.png);
|
||||
}
|
||||
|
||||
.logRow-warning {
|
||||
background-color: cyan;
|
||||
background-image: url(warningIcon.png);
|
||||
}
|
||||
|
||||
.logRow-error {
|
||||
background-color: LightYellow;
|
||||
background-image: url(errorIcon.png);
|
||||
}
|
||||
|
||||
.errorMessage {
|
||||
vertical-align: top;
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
.objectBox-sourceLink {
|
||||
position: absolute;
|
||||
right: 4px;
|
||||
top: 2px;
|
||||
padding-left: 8px;
|
||||
font-family: Lucida Grande, sans-serif;
|
||||
font-weight: bold;
|
||||
color: #0000FF;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.logRow-group {
|
||||
background: #EEEEEE;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.logGroup {
|
||||
background: #EEEEEE;
|
||||
}
|
||||
|
||||
.logGroupBox {
|
||||
margin-left: 24px;
|
||||
border-top: 1px solid #D7D7D7;
|
||||
border-left: 1px solid #D7D7D7;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.selectorTag,
|
||||
.selectorId,
|
||||
.selectorClass {
|
||||
font-family: Monaco, monospace;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.selectorTag {
|
||||
color: #0000FF;
|
||||
}
|
||||
|
||||
.selectorId {
|
||||
color: DarkBlue;
|
||||
}
|
||||
|
||||
.selectorClass {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.objectBox-element {
|
||||
font-family: Monaco, monospace;
|
||||
color: #000088;
|
||||
}
|
||||
|
||||
.nodeChildren {
|
||||
margin-left: 16px;
|
||||
}
|
||||
|
||||
.nodeTag {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.nodeValue {
|
||||
color: #FF0000;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
.nodeText,
|
||||
.nodeComment {
|
||||
margin: 0 2px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.nodeText {
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.nodeComment {
|
||||
color: DarkGreen;
|
||||
}
|
||||
|
||||
/************************************************************************************************/
|
||||
|
||||
.propertyNameCell {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.propertyName {
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<title>Firebug</title>
|
||||
<link rel="stylesheet" type="text/css" href="firebug.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="toolbar" class="toolbar">
|
||||
<a href="#" onclick="parent.console.clear()">Clear</a>
|
||||
<span class="toolbarRight">
|
||||
<a href="#" onclick="parent.console.close()">Close</a>
|
||||
</span>
|
||||
</div>
|
||||
<div id="log"></div>
|
||||
<input type="text" id="commandLine">
|
||||
|
||||
<script>parent.onFirebugReady(document);</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,672 @@
|
||||
|
||||
if (!("console" in window) || !("firebug" in console)) {
|
||||
(function()
|
||||
{
|
||||
window.console =
|
||||
{
|
||||
log: function()
|
||||
{
|
||||
logFormatted(arguments, "");
|
||||
},
|
||||
|
||||
debug: function()
|
||||
{
|
||||
logFormatted(arguments, "debug");
|
||||
},
|
||||
|
||||
info: function()
|
||||
{
|
||||
logFormatted(arguments, "info");
|
||||
},
|
||||
|
||||
warn: function()
|
||||
{
|
||||
logFormatted(arguments, "warning");
|
||||
},
|
||||
|
||||
error: function()
|
||||
{
|
||||
logFormatted(arguments, "error");
|
||||
},
|
||||
|
||||
assert: function(truth, message)
|
||||
{
|
||||
if (!truth)
|
||||
{
|
||||
var args = [];
|
||||
for (var i = 1; i < arguments.length; ++i)
|
||||
args.push(arguments[i]);
|
||||
|
||||
logFormatted(args.length ? args : ["Assertion Failure"], "error");
|
||||
throw message ? message : "Assertion Failure";
|
||||
}
|
||||
},
|
||||
|
||||
dir: function(object)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
var pairs = [];
|
||||
for (var name in object)
|
||||
{
|
||||
try
|
||||
{
|
||||
pairs.push([name, object[name]]);
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
pairs.sort(function(a, b) { return a[0] < b[0] ? -1 : 1; });
|
||||
|
||||
html.push('<table>');
|
||||
for (var i = 0; i < pairs.length; ++i)
|
||||
{
|
||||
var name = pairs[i][0], value = pairs[i][1];
|
||||
|
||||
html.push('<tr>',
|
||||
'<td class="propertyNameCell"><span class="propertyName">',
|
||||
escapeHTML(name), '</span></td>', '<td><span class="propertyValue">');
|
||||
appendObject(value, html);
|
||||
html.push('</span></td></tr>');
|
||||
}
|
||||
html.push('</table>');
|
||||
|
||||
logRow(html, "dir");
|
||||
},
|
||||
|
||||
dirxml: function(node)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
appendNode(node, html);
|
||||
logRow(html, "dirxml");
|
||||
},
|
||||
|
||||
group: function()
|
||||
{
|
||||
logRow(arguments, "group", pushGroup);
|
||||
},
|
||||
|
||||
groupEnd: function()
|
||||
{
|
||||
logRow(arguments, "", popGroup);
|
||||
},
|
||||
|
||||
time: function(name)
|
||||
{
|
||||
timeMap[name] = (new Date()).getTime();
|
||||
},
|
||||
|
||||
timeEnd: function(name)
|
||||
{
|
||||
if (name in timeMap)
|
||||
{
|
||||
var delta = (new Date()).getTime() - timeMap[name];
|
||||
logFormatted([name+ ":", delta+"ms"]);
|
||||
delete timeMap[name];
|
||||
}
|
||||
},
|
||||
|
||||
count: function()
|
||||
{
|
||||
this.warn(["count() not supported."]);
|
||||
},
|
||||
|
||||
trace: function()
|
||||
{
|
||||
this.warn(["trace() not supported."]);
|
||||
},
|
||||
|
||||
profile: function()
|
||||
{
|
||||
this.warn(["profile() not supported."]);
|
||||
},
|
||||
|
||||
profileEnd: function()
|
||||
{
|
||||
},
|
||||
|
||||
clear: function()
|
||||
{
|
||||
consoleBody.innerHTML = "";
|
||||
},
|
||||
|
||||
open: function()
|
||||
{
|
||||
toggleConsole(true);
|
||||
},
|
||||
|
||||
close: function()
|
||||
{
|
||||
if (frameVisible)
|
||||
toggleConsole();
|
||||
}
|
||||
};
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
var consoleFrame = null;
|
||||
var consoleBody = null;
|
||||
var commandLine = null;
|
||||
|
||||
var frameVisible = false;
|
||||
var messageQueue = [];
|
||||
var groupStack = [];
|
||||
var timeMap = {};
|
||||
|
||||
var clPrefix = ">>> ";
|
||||
|
||||
var isFirefox = navigator.userAgent.indexOf("Firefox") != -1;
|
||||
var isIE = navigator.userAgent.indexOf("MSIE") != -1;
|
||||
var isOpera = navigator.userAgent.indexOf("Opera") != -1;
|
||||
var isSafari = navigator.userAgent.indexOf("AppleWebKit") != -1;
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function toggleConsole(forceOpen)
|
||||
{
|
||||
frameVisible = forceOpen || !frameVisible;
|
||||
if (consoleFrame)
|
||||
consoleFrame.style.visibility = frameVisible ? "visible" : "hidden";
|
||||
else
|
||||
waitForBody();
|
||||
}
|
||||
|
||||
function focusCommandLine()
|
||||
{
|
||||
toggleConsole(true);
|
||||
if (commandLine)
|
||||
commandLine.focus();
|
||||
}
|
||||
|
||||
function waitForBody()
|
||||
{
|
||||
if (document.body)
|
||||
createFrame();
|
||||
else
|
||||
setTimeout(waitForBody, 200);
|
||||
}
|
||||
|
||||
function createFrame()
|
||||
{
|
||||
if (consoleFrame)
|
||||
return;
|
||||
|
||||
window.onFirebugReady = function(doc)
|
||||
{
|
||||
window.onFirebugReady = null;
|
||||
|
||||
var toolbar = doc.getElementById("toolbar");
|
||||
toolbar.onmousedown = onSplitterMouseDown;
|
||||
|
||||
commandLine = doc.getElementById("commandLine");
|
||||
addEvent(commandLine, "keydown", onCommandLineKeyDown);
|
||||
|
||||
addEvent(doc, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
|
||||
|
||||
consoleBody = doc.getElementById("log");
|
||||
layout();
|
||||
flush();
|
||||
}
|
||||
|
||||
var baseURL = getFirebugURL();
|
||||
|
||||
consoleFrame = document.createElement("iframe");
|
||||
consoleFrame.setAttribute("src", baseURL+"/firebug.html");
|
||||
consoleFrame.setAttribute("frameBorder", "0");
|
||||
consoleFrame.style.visibility = (frameVisible ? "visible" : "hidden");
|
||||
consoleFrame.style.zIndex = "2147483647";
|
||||
consoleFrame.style.position = "fixed";
|
||||
consoleFrame.style.width = "100%";
|
||||
consoleFrame.style.left = "0";
|
||||
consoleFrame.style.bottom = "0";
|
||||
consoleFrame.style.height = "200px";
|
||||
document.body.appendChild(consoleFrame);
|
||||
}
|
||||
|
||||
function getFirebugURL()
|
||||
{
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
for (var i = 0; i < scripts.length; ++i)
|
||||
{
|
||||
if (scripts[i].src.indexOf("firebug.js") != -1)
|
||||
{
|
||||
var lastSlash = scripts[i].src.lastIndexOf("/");
|
||||
return scripts[i].src.substr(0, lastSlash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function evalCommandLine()
|
||||
{
|
||||
var text = commandLine.value;
|
||||
commandLine.value = "";
|
||||
|
||||
logRow([clPrefix, text], "command");
|
||||
|
||||
var value;
|
||||
try
|
||||
{
|
||||
value = eval(text);
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
}
|
||||
|
||||
console.log(value);
|
||||
}
|
||||
|
||||
function layout()
|
||||
{
|
||||
var toolbar = consoleBody.ownerDocument.getElementById("toolbar");
|
||||
var height = consoleFrame.offsetHeight - (toolbar.offsetHeight + commandLine.offsetHeight);
|
||||
consoleBody.style.top = toolbar.offsetHeight + "px";
|
||||
consoleBody.style.height = height + "px";
|
||||
|
||||
commandLine.style.top = (consoleFrame.offsetHeight - commandLine.offsetHeight) + "px";
|
||||
}
|
||||
|
||||
function logRow(message, className, handler)
|
||||
{
|
||||
if (consoleBody)
|
||||
writeMessage(message, className, handler);
|
||||
else
|
||||
{
|
||||
messageQueue.push([message, className, handler]);
|
||||
waitForBody();
|
||||
}
|
||||
}
|
||||
|
||||
function flush()
|
||||
{
|
||||
var queue = messageQueue;
|
||||
messageQueue = [];
|
||||
|
||||
for (var i = 0; i < queue.length; ++i)
|
||||
writeMessage(queue[i][0], queue[i][1], queue[i][2]);
|
||||
}
|
||||
|
||||
function writeMessage(message, className, handler)
|
||||
{
|
||||
var isScrolledToBottom =
|
||||
consoleBody.scrollTop + consoleBody.offsetHeight >= consoleBody.scrollHeight;
|
||||
|
||||
if (!handler)
|
||||
handler = writeRow;
|
||||
|
||||
handler(message, className);
|
||||
|
||||
if (isScrolledToBottom)
|
||||
consoleBody.scrollTop = consoleBody.scrollHeight - consoleBody.offsetHeight;
|
||||
}
|
||||
|
||||
function appendRow(row)
|
||||
{
|
||||
var container = groupStack.length ? groupStack[groupStack.length-1] : consoleBody;
|
||||
container.appendChild(row);
|
||||
}
|
||||
|
||||
function writeRow(message, className)
|
||||
{
|
||||
var row = consoleBody.ownerDocument.createElement("div");
|
||||
row.className = "logRow" + (className ? " logRow-"+className : "");
|
||||
row.innerHTML = message.join("");
|
||||
appendRow(row);
|
||||
}
|
||||
|
||||
function pushGroup(message, className)
|
||||
{
|
||||
logFormatted(message, className);
|
||||
|
||||
var groupRow = consoleBody.ownerDocument.createElement("div");
|
||||
groupRow.className = "logGroup";
|
||||
var groupRowBox = consoleBody.ownerDocument.createElement("div");
|
||||
groupRowBox.className = "logGroupBox";
|
||||
groupRow.appendChild(groupRowBox);
|
||||
appendRow(groupRowBox);
|
||||
groupStack.push(groupRowBox);
|
||||
}
|
||||
|
||||
function popGroup()
|
||||
{
|
||||
groupStack.pop();
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function logFormatted(objects, className)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
var format = objects[0];
|
||||
var objIndex = 0;
|
||||
|
||||
if (typeof(format) != "string")
|
||||
{
|
||||
format = "";
|
||||
objIndex = -1;
|
||||
}
|
||||
|
||||
var parts = parseFormat(format);
|
||||
for (var i = 0; i < parts.length; ++i)
|
||||
{
|
||||
var part = parts[i];
|
||||
if (part && typeof(part) == "object")
|
||||
{
|
||||
var object = objects[++objIndex];
|
||||
part.appender(object, html);
|
||||
}
|
||||
else
|
||||
appendText(part, html);
|
||||
}
|
||||
|
||||
for (var i = objIndex+1; i < objects.length; ++i)
|
||||
{
|
||||
appendText(" ", html);
|
||||
|
||||
var object = objects[i];
|
||||
if (typeof(object) == "string")
|
||||
appendText(object, html);
|
||||
else
|
||||
appendObject(object, html);
|
||||
}
|
||||
|
||||
logRow(html, className);
|
||||
}
|
||||
|
||||
function parseFormat(format)
|
||||
{
|
||||
var parts = [];
|
||||
|
||||
var reg = /((^%|[^\\]%)(\d+)?(\.)([a-zA-Z]))|((^%|[^\\]%)([a-zA-Z]))/;
|
||||
var appenderMap = {s: appendText, d: appendInteger, i: appendInteger, f: appendFloat};
|
||||
|
||||
for (var m = reg.exec(format); m; m = reg.exec(format))
|
||||
{
|
||||
var type = m[8] ? m[8] : m[5];
|
||||
var appender = type in appenderMap ? appenderMap[type] : appendObject;
|
||||
var precision = m[3] ? parseInt(m[3]) : (m[4] == "." ? -1 : 0);
|
||||
|
||||
parts.push(format.substr(0, m[0][0] == "%" ? m.index : m.index+1));
|
||||
parts.push({appender: appender, precision: precision});
|
||||
|
||||
format = format.substr(m.index+m[0].length);
|
||||
}
|
||||
|
||||
parts.push(format);
|
||||
|
||||
return parts;
|
||||
}
|
||||
|
||||
function escapeHTML(value)
|
||||
{
|
||||
function replaceChars(ch)
|
||||
{
|
||||
switch (ch)
|
||||
{
|
||||
case "<":
|
||||
return "<";
|
||||
case ">":
|
||||
return ">";
|
||||
case "&":
|
||||
return "&";
|
||||
case "'":
|
||||
return "'";
|
||||
case '"':
|
||||
return """;
|
||||
}
|
||||
return "?";
|
||||
};
|
||||
return String(value).replace(/[<>&"']/g, replaceChars);
|
||||
}
|
||||
|
||||
function objectToString(object)
|
||||
{
|
||||
try
|
||||
{
|
||||
return object+"";
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function appendText(object, html)
|
||||
{
|
||||
html.push(escapeHTML(objectToString(object)));
|
||||
}
|
||||
|
||||
function appendNull(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-null">', escapeHTML(objectToString(object)), '</span>');
|
||||
}
|
||||
|
||||
function appendString(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-string">"', escapeHTML(objectToString(object)),
|
||||
'"</span>');
|
||||
}
|
||||
|
||||
function appendInteger(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
|
||||
}
|
||||
|
||||
function appendFloat(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-number">', escapeHTML(objectToString(object)), '</span>');
|
||||
}
|
||||
|
||||
function appendFunction(object, html)
|
||||
{
|
||||
var reName = /function ?(.*?)\(/;
|
||||
var m = reName.exec(objectToString(object));
|
||||
var name = m ? m[1] : "function";
|
||||
html.push('<span class="objectBox-function">', escapeHTML(name), '()</span>');
|
||||
}
|
||||
|
||||
function appendObject(object, html)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (object == undefined)
|
||||
appendNull("undefined", html);
|
||||
else if (object == null)
|
||||
appendNull("null", html);
|
||||
else if (typeof object == "string")
|
||||
appendString(object, html);
|
||||
else if (typeof object == "number")
|
||||
appendInteger(object, html);
|
||||
else if (typeof object == "function")
|
||||
appendFunction(object, html);
|
||||
else if (object.nodeType == 1)
|
||||
appendSelector(object, html);
|
||||
else if (typeof object == "object")
|
||||
appendObjectFormatted(object, html);
|
||||
else
|
||||
appendText(object, html);
|
||||
}
|
||||
catch (exc)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
function appendObjectFormatted(object, html)
|
||||
{
|
||||
var text = objectToString(object);
|
||||
var reObject = /\[object (.*?)\]/;
|
||||
|
||||
var m = reObject.exec(text);
|
||||
html.push('<span class="objectBox-object">', m ? m[1] : text, '</span>')
|
||||
}
|
||||
|
||||
function appendSelector(object, html)
|
||||
{
|
||||
html.push('<span class="objectBox-selector">');
|
||||
|
||||
html.push('<span class="selectorTag">', escapeHTML(object.nodeName.toLowerCase()), '</span>');
|
||||
if (object.id)
|
||||
html.push('<span class="selectorId">#', escapeHTML(object.id), '</span>');
|
||||
if (object.className)
|
||||
html.push('<span class="selectorClass">.', escapeHTML(object.className), '</span>');
|
||||
|
||||
html.push('</span>');
|
||||
}
|
||||
|
||||
function appendNode(node, html)
|
||||
{
|
||||
if (node.nodeType == 1)
|
||||
{
|
||||
html.push(
|
||||
'<div class="objectBox-element">',
|
||||
'<<span class="nodeTag">', node.nodeName.toLowerCase(), '</span>');
|
||||
|
||||
for (var i = 0; i < node.attributes.length; ++i)
|
||||
{
|
||||
var attr = node.attributes[i];
|
||||
if (!attr.specified)
|
||||
continue;
|
||||
|
||||
html.push(' <span class="nodeName">', attr.nodeName.toLowerCase(),
|
||||
'</span>="<span class="nodeValue">', escapeHTML(attr.nodeValue),
|
||||
'</span>"')
|
||||
}
|
||||
|
||||
if (node.firstChild)
|
||||
{
|
||||
html.push('></div><div class="nodeChildren">');
|
||||
|
||||
for (var child = node.firstChild; child; child = child.nextSibling)
|
||||
appendNode(child, html);
|
||||
|
||||
html.push('</div><div class="objectBox-element"></<span class="nodeTag">',
|
||||
node.nodeName.toLowerCase(), '></span></div>');
|
||||
}
|
||||
else
|
||||
html.push('/></div>');
|
||||
}
|
||||
else if (node.nodeType == 3)
|
||||
{
|
||||
html.push('<div class="nodeText">', escapeHTML(node.nodeValue),
|
||||
'</div>');
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************************
|
||||
|
||||
function addEvent(object, name, handler)
|
||||
{
|
||||
if (document.all)
|
||||
object.attachEvent("on"+name, handler);
|
||||
else
|
||||
object.addEventListener(name, handler, false);
|
||||
}
|
||||
|
||||
function removeEvent(object, name, handler)
|
||||
{
|
||||
if (document.all)
|
||||
object.detachEvent("on"+name, handler);
|
||||
else
|
||||
object.removeEventListener(name, handler, false);
|
||||
}
|
||||
|
||||
function cancelEvent(event)
|
||||
{
|
||||
if (document.all)
|
||||
event.cancelBubble = true;
|
||||
else
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
function onError(msg, href, lineNo)
|
||||
{
|
||||
var html = [];
|
||||
|
||||
var lastSlash = href.lastIndexOf("/");
|
||||
var fileName = lastSlash == -1 ? href : href.substr(lastSlash+1);
|
||||
|
||||
html.push(
|
||||
'<span class="errorMessage">', msg, '</span>',
|
||||
'<div class="objectBox-sourceLink">', fileName, ' (line ', lineNo, ')</div>'
|
||||
);
|
||||
|
||||
logRow(html, "error");
|
||||
};
|
||||
|
||||
function onKeyDown(event)
|
||||
{
|
||||
if (event.keyCode == 123)
|
||||
toggleConsole();
|
||||
else if ((event.keyCode == 108 || event.keyCode == 76) && event.shiftKey
|
||||
&& (event.metaKey || event.ctrlKey))
|
||||
focusCommandLine();
|
||||
else
|
||||
return;
|
||||
|
||||
cancelEvent(event);
|
||||
}
|
||||
|
||||
function onSplitterMouseDown(event)
|
||||
{
|
||||
if (isSafari || isOpera)
|
||||
return;
|
||||
|
||||
addEvent(document, "mousemove", onSplitterMouseMove);
|
||||
addEvent(document, "mouseup", onSplitterMouseUp);
|
||||
|
||||
for (var i = 0; i < frames.length; ++i)
|
||||
{
|
||||
addEvent(frames[i].document, "mousemove", onSplitterMouseMove);
|
||||
addEvent(frames[i].document, "mouseup", onSplitterMouseUp);
|
||||
}
|
||||
}
|
||||
|
||||
function onSplitterMouseMove(event)
|
||||
{
|
||||
var win = document.all
|
||||
? event.srcElement.ownerDocument.parentWindow
|
||||
: event.target.ownerDocument.defaultView;
|
||||
|
||||
var clientY = event.clientY;
|
||||
if (win != win.parent)
|
||||
clientY += win.frameElement ? win.frameElement.offsetTop : 0;
|
||||
|
||||
var height = consoleFrame.offsetTop + consoleFrame.clientHeight;
|
||||
var y = height - clientY;
|
||||
|
||||
consoleFrame.style.height = y + "px";
|
||||
layout();
|
||||
}
|
||||
|
||||
function onSplitterMouseUp(event)
|
||||
{
|
||||
removeEvent(document, "mousemove", onSplitterMouseMove);
|
||||
removeEvent(document, "mouseup", onSplitterMouseUp);
|
||||
|
||||
for (var i = 0; i < frames.length; ++i)
|
||||
{
|
||||
removeEvent(frames[i].document, "mousemove", onSplitterMouseMove);
|
||||
removeEvent(frames[i].document, "mouseup", onSplitterMouseUp);
|
||||
}
|
||||
}
|
||||
|
||||
function onCommandLineKeyDown(event)
|
||||
{
|
||||
if (event.keyCode == 13)
|
||||
evalCommandLine();
|
||||
else if (event.keyCode == 27)
|
||||
commandLine.value = "";
|
||||
}
|
||||
|
||||
window.onerror = onError;
|
||||
addEvent(document, isIE || isSafari ? "keydown" : "keypress", onKeyDown);
|
||||
|
||||
if (document.documentElement.getAttribute("debug") == "true")
|
||||
toggleConsole(true);
|
||||
})();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
|
||||
if (!("console" in window) || !("firebug" in console))
|
||||
{
|
||||
var names = ["log", "debug", "info", "warn", "error", "assert", "dir", "dirxml",
|
||||
"group", "groupEnd", "time", "timeEnd", "count", "trace", "profile", "profileEnd"];
|
||||
|
||||
window.console = {};
|
||||
for (var i = 0; i < names.length; ++i)
|
||||
window.console[names[i]] = function() {}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 524 B |
Binary file not shown.
|
After Width: | Height: | Size: 516 B |
@@ -0,0 +1,348 @@
|
||||
<!DOCTYPE html>
|
||||
<html id="html">
|
||||
<head>
|
||||
<title>jQuery - Validation Test Suite</title>
|
||||
<link rel="stylesheet" href="qunit/qunit.css" />
|
||||
<script src="jquery.js"></script>
|
||||
<script src="../lib/jquery.form.js"></script>
|
||||
<script src="qunit/qunit.js"></script>
|
||||
<script src="../lib/jquery.mockjax.js"></script>
|
||||
<script src="../jquery.validate.js"></script>
|
||||
<script src="../additional-methods.js"></script>
|
||||
<script src="test.js"></script>
|
||||
<script src="rules.js"></script>
|
||||
<script src="messages.js"></script>
|
||||
<script src="methods.js"></script>
|
||||
</head>
|
||||
<body id="body">
|
||||
<h1 id="qunit-header">
|
||||
<a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Test Suite
|
||||
<a href="?jquery=1.6.4">jQuery 1.6.4</a>
|
||||
<a href="?jquery=1.7.2">jQuery 1.7.2</a>
|
||||
<a href="?jquery=1.8.3">jQuery 1.8.3</a>
|
||||
<a href="?jquery=1.9.0">jQuery 1.9.0</a>
|
||||
<a href="?jquery=git">jQuery Latest (git)</a>
|
||||
</h1>
|
||||
<div>
|
||||
</div>
|
||||
<h2 id="qunit-banner"></h2>
|
||||
<div id="qunit-testrunner-toolbar"></div>
|
||||
<h2 id="qunit-userAgent"></h2>
|
||||
<ol id="qunit-tests"></ol>
|
||||
|
||||
<!-- Test HTML -->
|
||||
<div id="other" style="display:none;">
|
||||
<input type="password" name="pw1" id="pw1" value="engfeh" />
|
||||
<input type="password" name="pw2" id="pw2" value="" />
|
||||
</div>
|
||||
<div id="qunit-fixture">
|
||||
<p id="firstp">See <a id="simon1" href="http://simon.incutio.com/archive/2003/03/25/#getElementsBySelector" rel="bookmark">this blog entry</a> for more information.</p>
|
||||
<p id="ap">
|
||||
Here are some links in a normal paragraph: <a id="google" href="http://www.google.com/" title="Google!">Google</a>,
|
||||
<a id="groups" href="http://groups.google.com/">Google Groups</a>.
|
||||
This link has <code><a href="#" id="anchor1">class="blog"</a></code>:
|
||||
<a href="http://diveintomark.org/" class="blog" hreflang="en" id="mark">diveintomark</a>
|
||||
|
||||
</p>
|
||||
<div id="foo">
|
||||
<p id="sndp">Everything inside the red border is inside a div with <code>id="foo"</code>.</p>
|
||||
<p lang="en" id="en">This is a normal link: <a id="yahoo" href="http://www.yahoo.com/" class="blogTest">Yahoo</a></p>
|
||||
<p id="sap">This link has <code><a href="#2" id="anchor2">class="blog"</a></code>: <a href="http://simon.incutio.com/" class="blog link" id="simon">Simon Willison's Weblog</a></p>
|
||||
|
||||
</div>
|
||||
<p id="first">Try them out:</p>
|
||||
<ul id="firstUL"></ul>
|
||||
<ol id="empty"></ol>
|
||||
|
||||
<form id="testForm1">
|
||||
<input type="text" data-rule-required="true" data-rule-minlength="2" title="buga" name="firstname" id="firstname" />
|
||||
<label id="errorFirstname" for="firstname" class="error">error for firstname</label>
|
||||
<input type="text" data-rule-required="true" title="buga" name="lastname" id="lastname" />
|
||||
<input type="text" data-rule-required="true" title="something" name="something" id="something" value="something" />
|
||||
</form>
|
||||
|
||||
<form id="testForm1clean">
|
||||
<input title="buga" name="firstname" id="firstnamec" />
|
||||
<label id="errorFirstname" for="firstname" class="error">error for firstname</label>
|
||||
<input title="buga" name="lastname" id="lastnamec" />
|
||||
<input name="username" id="usernamec" />
|
||||
</form>
|
||||
|
||||
<form id="userForm">
|
||||
<input type="text" data-rule-required="true" name="username" id="username" />
|
||||
<input type="submit" name="submitButton" value="submitButtonValue" />
|
||||
</form>
|
||||
|
||||
<form id="signupForm" action="form.php">
|
||||
<input id="user" name="user" title="Please enter your username (at least 3 characters)" data-rule-required="true" data-rule-minlength="3" />
|
||||
<input type="password" name="password" id="password" data-rule-required="true" data-rule-minlength="5" />
|
||||
</form>
|
||||
|
||||
<form id="testForm2">
|
||||
<input data-rule-required="true" type="radio" name="agree" id="agb" />
|
||||
<label for="agree" id="agreeLabel" class="xerror">error for agb</label>
|
||||
</form>
|
||||
|
||||
<form id="testForm3">
|
||||
<select data-rule-required="true" name="meal" id="meal" >
|
||||
<option value="">Please select...</option>
|
||||
<option value="1">Food</option>
|
||||
<option value="2">Milk</option>
|
||||
</select>
|
||||
</form>
|
||||
<div class="error" id="errorContainer">
|
||||
<ul>
|
||||
<li class="error" id="errorWrapper">
|
||||
<label for="meal" id="mealLabel" class="error">error for meal</label>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<form id="testForm4">
|
||||
<input data-rule-foo="true" name="f1" id="f1" />
|
||||
<input data-rule-bar="true" name="f2" id="f2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm5">
|
||||
<input data-rule-equalto="#x2" value="x" name="x1" id="x1" />
|
||||
<input data-rule-equalto="#x1" value="y" name="x2" id="x2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm6">
|
||||
<input data-rule-required="true" data-rule-minlength="2" type="checkbox" name="check" id="form6check1" />
|
||||
<input type="checkbox" name="check" id="form6check2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm7">
|
||||
<select data-rule-required="true" data-rule-minlength="2" name="selectf7" id="selectf7" multiple="multiple">
|
||||
<option id="optionxa" value="0">0</option>
|
||||
<option id="optionxb" value="1">1</option>
|
||||
<option id="optionxc" value="2">2</option>
|
||||
<option id="optionxd" value="3">3</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<form id="dateRangeForm">
|
||||
<input id="fromDate" name="fromDate" class="requiredDateRange" value="x" />
|
||||
<input id="toDate" name="toDate" class="requiredDateRange" value="y" />
|
||||
<span class="errorContainer"></span>
|
||||
</form>
|
||||
|
||||
<form id="testForm8">
|
||||
<input id="form8input" data-rule-required="true" data-rule-number="true" data-rule-rangelength="2,8" name="abc" />
|
||||
<input type="radio" name="radio1"/>
|
||||
</form>
|
||||
|
||||
<form id="testForm9">
|
||||
<input id="testEmail9" data-rule-required="true" data-rule-email="true" data-msg-required="required" data-msg-email="email" />
|
||||
</form>
|
||||
|
||||
<form id="testForm10">
|
||||
<input type="radio" name="testForm10Radio" value="1" id="testForm10Radio1" />
|
||||
<input type="radio" name="testForm10Radio" value="2" id="testForm10Radio2" />
|
||||
</form>
|
||||
|
||||
<form id="testForm11">
|
||||
<!-- HTML5 -->
|
||||
<input required type="text" name="testForm11Text" id="testForm11text1" />
|
||||
</form>
|
||||
|
||||
<form id="testForm12">
|
||||
<!-- empty "type" attribute -->
|
||||
<input name="testForm12text" id="testForm12text" data-rule-required="true" />
|
||||
</form>
|
||||
|
||||
<form id="dataMessages">
|
||||
<input name="dataMessagesName" id="dataMessagesName" class="required" data-msg-required="You must enter a value here" />
|
||||
</form>
|
||||
|
||||
<div id="simplecontainer">
|
||||
<h3></h3>
|
||||
</div>
|
||||
|
||||
<div id="container" style="min-height:1px"></div>
|
||||
|
||||
<ol id="labelcontainer"></ol>
|
||||
|
||||
<form id="elementsOrder">
|
||||
<select class="required" name="order1" id="order1"><option value="">none</option></select>
|
||||
<input class="required" name="order2" id="order2"/>
|
||||
<input class="required" name="order3" type="checkbox" id="order3"/>
|
||||
<input class="required" name="order4" id="order4"/>
|
||||
<input class="required" name="order5" type="radio" id="order5"/>
|
||||
<input class="required" name="order6" id="order6"/>
|
||||
<ul id="orderContainer">
|
||||
</ul>
|
||||
</form>
|
||||
|
||||
<form id="form" action="formaction">
|
||||
<input type="text" name="action" value="Test" id="text1"/>
|
||||
<input type="text" name="text2" value=" " id="text1b"/>
|
||||
<input type="text" name="text2" value="T " id="text1c"/>
|
||||
<input type="text" name="text2" value="T" id="text2"/>
|
||||
<input type="text" name="text2" value="TestTestTest" id="text3"/>
|
||||
|
||||
<input type="text" name="action" value="0" id="value1"/>
|
||||
<input type="text" name="text2" value="10" id="value2"/>
|
||||
<input type="text" name="text2" value="1000" id="value3"/>
|
||||
|
||||
<input type="radio" name="radio1" id="radio1"/>
|
||||
<input type="radio" name="radio1" id="radio1a"/>
|
||||
<input type="radio" name="radio2" id="radio2" checked="checked"/>
|
||||
<input type="radio" name="radio" id="radio3"/>
|
||||
<input type="radio" name="radio" id="radio4" checked="checked"/>
|
||||
|
||||
<input type="checkbox" name="check" id="check1" checked="checked"/>
|
||||
<input type="checkbox" name="check" id="check1b" />
|
||||
|
||||
<input type="checkbox" name="check2" id="check2"/>
|
||||
|
||||
<input type="checkbox" name="check3" id="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
<input type="checkbox" name="check3" checked="checked"/>
|
||||
|
||||
<input type="hidden" name="hidden" id="hidden1"/>
|
||||
<input type="text" style="display:none;" name="foo[bar]" id="hidden2"/>
|
||||
|
||||
<input type="text" readonly="readonly" id="name" name="name" value="name" />
|
||||
|
||||
<button name="button">Button</button>
|
||||
|
||||
<textarea id="area1" name="area1">foobar</textarea>
|
||||
|
||||
|
||||
<textarea id="area2" name="area2"></textarea>
|
||||
|
||||
<select name="select1" id="select1">
|
||||
<option id="option1a" value="">Nothing</option>
|
||||
<option id="option1b" value="1">1</option>
|
||||
<option id="option1c" value="2">2</option>
|
||||
<option id="option1d" value="3">3</option>
|
||||
</select>
|
||||
<select name="select2" id="select2">
|
||||
<option id="option2a" value="">Nothing</option>
|
||||
<option id="option2b" value="1">1</option>
|
||||
<option id="option2c" value="2">2</option>
|
||||
<option id="option2d" selected="selected" value="3">3</option>
|
||||
</select>
|
||||
<select name="select3" id="select3" multiple="multiple">
|
||||
<option id="option3a" value="">Nothing</option>
|
||||
<option id="option3b" selected="selected" value="1">1</option>
|
||||
<option id="option3c" selected="selected" value="2">2</option>
|
||||
<option id="option3d" value="3">3</option>
|
||||
</select>
|
||||
<select name="select4" id="select4" multiple="multiple">
|
||||
<option id="option4a" selected="selected" value="1">1</option>
|
||||
<option id="option4b" selected="selected" value="2">2</option>
|
||||
<option id="option4c" selected="selected" value="3">3</option>
|
||||
<option id="option4d" selected="selected" value="4">4</option>
|
||||
<option id="option4e" selected="selected" value="5">5</option>
|
||||
</select>
|
||||
<select name="select5" id="select5" multiple="multiple">
|
||||
<option id="option5a" value="0">0</option>
|
||||
<option id="option5b" value="1">1</option>
|
||||
<option id="option5c" value="2">2</option>
|
||||
<option id="option5d" value="3">3</option>
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<form id="v2">
|
||||
<input id="v2-i1" name="v2-i1" class="required" />
|
||||
<input id="v2-i2" name="v2-i2" class="required email" />
|
||||
<input id="v2-i3" name="v2-i3" class="url" />
|
||||
<input id="v2-i4" name="v2-i4" class="required" minlength="2" />
|
||||
<input id="v2-i5" name="v2-i5" class="required" minlength="2" maxlength="5" customMethod1="123" />
|
||||
<input id="v2-i6" name="v2-i6" class="required customMethod2" data-rule-maxlength="5" data-rule-minlength="2" />
|
||||
<input id="v2-i7" name="v2-i7" />
|
||||
</form>
|
||||
|
||||
<form id="checkables">
|
||||
<input type="checkbox" id="checkable1" name="checkablesgroup" class="required" />
|
||||
<input type="checkbox" id="checkable2" name="checkablesgroup" />
|
||||
<input type="checkbox" id="checkable3" name="checkablesgroup" />
|
||||
</form>
|
||||
|
||||
<form id="subformRequired">
|
||||
<div class="billingAddressControl">
|
||||
<input type="checkbox" id="bill_to_co" name="bill_to_co" class="toggleCheck" checked="checked" style="width: auto;" tabindex="1" />
|
||||
<label for="bill_to_co" style="cursor:pointer">Same as Company Address</label>
|
||||
</div>
|
||||
<div id="subform">
|
||||
<input maxlength="40" class="billingRequired" name="bill_first_name" size="20" type="text" tabindex="2" value="" />
|
||||
</div>
|
||||
<input id="co_name" class="required" maxlength="40" name="co_name" size="20" type="text" tabindex="1" value="" />
|
||||
</form>
|
||||
|
||||
<form id="withTitle">
|
||||
<input class="required" name="hastitle" type="text" title="fromtitle" />
|
||||
</form>
|
||||
|
||||
<form id="ccform" method="get" action="">
|
||||
<input id="cardnumber" name="cardnumber" />
|
||||
</form>
|
||||
|
||||
<form id="productInfo">
|
||||
<input class="productInfo" name="partnumber">
|
||||
<input class="productInfo" name="description">
|
||||
<input class="productInfo" name="color">
|
||||
<input class="productInfo" type="checkbox" name="discount" />
|
||||
</form>
|
||||
|
||||
<form id="updateLabel">
|
||||
<input class="required" name="updateLabelInput" id="updateLabelInput" data-msg-required="You must enter a value here" />
|
||||
<label id="targetLabel" class="error" for="updateLabelInput">Some server-side error</label>
|
||||
</form>
|
||||
|
||||
<form id="rangesMinDateInvalid">
|
||||
<input type="date" id="minDateInvalid" name="minDateInvalid" min="2012-12-21" value="2012-11-21"/>
|
||||
</form>
|
||||
<form id="ranges">
|
||||
<input type="date" id="maxDateInvalid" ngame="maxDateInvalid" max="2012-12-21" value="2013-01-21"/>
|
||||
<input type="date" id="rangeDateInvalidGreater" name="rangeDateInvalidGreater" min="2012-11-21" max="2013-01-21" value="2013-02-21"/>
|
||||
<input type="date" id="rangeDateInvalidLess" name="rangeDateInvalidLess" min="2012-11-21" max="2013-01-21" value="2012-10-21"/>
|
||||
|
||||
<input type="date" id="maxDateValid" name="maxDateValid" max="2013-01-21" value="2012-12-21"/>
|
||||
<input type="date" id="rangeDateValid" name="rangeDateValid" min="2012-11-21" max="2013-01-21" value="2012-12-21"/>
|
||||
|
||||
<!-- input type text is not supposed to have min/max according to html5,
|
||||
but for backward compatibility with 1.10.0 we treat it as number.
|
||||
you can also use type="number", in which case the browser may also
|
||||
do validation, and mobile browsers may offer a numeric keypad to edit
|
||||
the value.
|
||||
Type absent is treated like type="text".
|
||||
-->
|
||||
<input type="text" id="rangeTextInvalidGreater" name="rangeTextInvalidGreater" min="50" max="200" value="1000"/>
|
||||
<input type="text" id="rangeTextInvalidLess" name="rangeTextInvalidLess" min="200" max="1000" value="50"/>
|
||||
<input id="rangeAbsentInvalidGreater" name="rangeAbsentInvalidGreater" min="50" max="200" value="1000"/>
|
||||
<input id="rangeAbsentInvalidLess" name="rangeAbsentInvalidLess" min="200" max="1000" value="50"/>
|
||||
|
||||
<input type="text" id="rangeTextValid" name="rangeTextValid" min="50" max="1000" value="200"/>
|
||||
<input id="rangeAbsentValid" name="rangeTextValid" min="50" max="1000" value="200"/>
|
||||
|
||||
<!-- ranges are like numbers in html5, except that browser is not required
|
||||
to demand an exact value. User interface could be a slider.
|
||||
-->
|
||||
<input type="range" id="rangeRangeValid" name="rangeRangeValid" min="50" max="1000" value="200"/>
|
||||
|
||||
<input type="number" id="rangeNumberValid" name="rangeNumberValid" min="50" max="1000" value="200"/>
|
||||
<input type="number" id="rangeNumberInvalidGreater" name="rangeNumberInvalidGreater" min="50" max="200" value="1000"/>
|
||||
<input type="number" id="rangeNumberInvalidLess" name="rangeNumberInvalidLess" min="50" max="200" value="6"/>
|
||||
|
||||
</form>
|
||||
<form id="rangeMinDateValid">
|
||||
<input type="date" id="minDateValid" name="minDateValid" min="2012-11-21" value="2012-12-21"/>
|
||||
</form>
|
||||
|
||||
<form id="bypassValidation">
|
||||
<input type="text" required/>
|
||||
<input id="normalSubmit" type="submit" value="submit"/>
|
||||
<input id="bypassSubmitWithCancel" type="submit" class="cancel" value="bypass1"/>
|
||||
<input id="bypassSubmitWithNoValidate1" type="submit" formnovalidate value="bypass1"/>
|
||||
<input id="bypassSubmitWithNoValidate2" type="submit" formnovalidate="formnovalidate" value="bypass2"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
25
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/test/jquery.js
vendored
Normal file
25
src/main/webapp/static/global/plugins/jquery-validation/1.11.1/test/jquery.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
(function() {
|
||||
|
||||
var parts = document.location.search.slice( 1 ).split( "&" ),
|
||||
length = parts.length,
|
||||
i = 0,
|
||||
current,
|
||||
version = "1.9.0",
|
||||
file = "http://code.jquery.com/jquery-git.js";
|
||||
|
||||
for ( ; i < length; i++ ) {
|
||||
current = parts[ i ].split( "=" );
|
||||
if ( current[ 0 ] === "jquery" ) {
|
||||
version = current[ 1 ];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (version != "git") {
|
||||
file = "../lib/jquery-" + version + ".js";
|
||||
}
|
||||
|
||||
|
||||
document.write( "<script src='" + file + "'></script>" );
|
||||
|
||||
})();
|
||||
@@ -0,0 +1,188 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
|
||||
<script src="../lib/jquery.ajaxQueue.js" type="text/javascript"></script>
|
||||
<script src="../jquery.validate.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$().ready(function() {
|
||||
$("#commentForm").validate();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
#commentForm { width: 500px; }
|
||||
#commentForm label { width: 250px; display: block; float: left; }
|
||||
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
|
||||
.focus { background-color: red; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
<fieldset>
|
||||
<legend>A simple comment form with submit validation and default messages</legend>
|
||||
<p>
|
||||
<label for="cname-x0">Name (required, at least 2 characters)</label>
|
||||
<input id="cname-x0" name="name-x0" class="some other styles {required:true,minLength:2}" />
|
||||
<p>
|
||||
<label for="cemail-x0">E-Mail (required)</label>
|
||||
<input id="cemail-x0" name="email-x0" class="{required:true,email:true}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x0">URL (optional)</label>
|
||||
<input id="curl-x0" name="url-x0" class="{url:true}" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x0">Your comment (required)</label>
|
||||
<textarea id="ccomment-x0" name="comment-x0" class="{required:true}"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x1">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x1" id="cname-x1"/>
|
||||
</p><p>
|
||||
<label for="cemail-x1">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x1" id="cemail-x1"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x1">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x1" id="curl-x1"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x1">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x1" id="ccomment-x1"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x2">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x2" id="cname-x2"/>
|
||||
</p><p>
|
||||
<label for="cemail-x2">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x2" id="cemail-x2"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x2">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x2" id="curl-x2"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x2">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x2" id="ccomment-x2"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x3">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x3" id="cname-x3"/>
|
||||
</p><p>
|
||||
<label for="cemail-x3">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x3" id="cemail-x3"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x3">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x3" id="curl-x3"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x3">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x3" id="ccomment-x3"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x4">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x4" id="cname-x4"/>
|
||||
</p><p>
|
||||
<label for="cemail-x4">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x4" id="cemail-x4"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x4">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x4" id="curl-x4"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x4">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x4" id="ccomment-x4"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x5">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x5" id="cname-x5"/>
|
||||
</p><p>
|
||||
<label for="cemail-x5">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x5" id="cemail-x5"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x5">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x5" id="curl-x5"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x5">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x5" id="ccomment-x5"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x6">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x6" id="cname-x6"/>
|
||||
</p><p>
|
||||
<label for="cemail-x6">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x6" id="cemail-x6"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x6">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x6" id="curl-x6"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x6">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x6" id="ccomment-x6"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x7">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x7" id="cname-x7"/>
|
||||
</p><p>
|
||||
<label for="cemail-x7">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x7" id="cemail-x7"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x7">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x7" id="curl-x7"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x7">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x7" id="ccomment-x7"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x8">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x8" id="cname-x8"/>
|
||||
</p><p>
|
||||
<label for="cemail-x8">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x8" id="cemail-x8"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x8">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x8" id="curl-x8"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x8">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x8" id="ccomment-x8"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<label for="cname-x9">Name (required, at least 2 characters)</label>
|
||||
<input class="some other styles {required:true,minLength:2}" name="name-x9" id="cname-x9"/>
|
||||
</p><p>
|
||||
<label for="cemail-x9">E-Mail (required)</label>
|
||||
<input class="{required:true,email:true}" name="email-x9" id="cemail-x9"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl-x9">URL (optional)</label>
|
||||
<input value="" class="{url:true}" name="url-x9" id="curl-x9"/>
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment-x9">Your comment (required)</label>
|
||||
<textarea class="{required:true}" name="comment-x9" id="ccomment-x9"></textarea>
|
||||
</p>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,62 @@
|
||||
module("messages");
|
||||
|
||||
test("predefined message not overwritten by addMethod(a, b, undefined)", function() {
|
||||
var message = "my custom message";
|
||||
$.validator.messages.custom = message;
|
||||
$.validator.addMethod("custom", function() {});
|
||||
deepEqual(message, $.validator.messages.custom);
|
||||
delete $.validator.messages.custom;
|
||||
delete $.validator.methods.custom;
|
||||
});
|
||||
|
||||
test("group error messages", function() {
|
||||
$.validator.addClassRules({
|
||||
requiredDateRange: {required:true, date:true, dateRange:true}
|
||||
});
|
||||
$.validator.addMethod("dateRange", function() {
|
||||
return new Date($("#fromDate").val()) < new Date($("#toDate").val());
|
||||
}, "Please specify a correct date range.");
|
||||
var form = $("#dateRangeForm");
|
||||
form.validate({
|
||||
groups: {
|
||||
dateRange: "fromDate toDate"
|
||||
},
|
||||
errorPlacement: function(error) {
|
||||
form.find(".errorContainer").append(error);
|
||||
}
|
||||
});
|
||||
ok( !form.valid() );
|
||||
equal( 1, form.find(".errorContainer *").length );
|
||||
equal( "Please enter a valid date.", form.find(".errorContainer label.error").text() );
|
||||
|
||||
$("#fromDate").val("12/03/2006");
|
||||
$("#toDate").val("12/01/2006");
|
||||
ok( !form.valid() );
|
||||
equal( "Please specify a correct date range.", form.find(".errorContainer label.error").text() );
|
||||
|
||||
$("#toDate").val("12/04/2006");
|
||||
ok( form.valid() );
|
||||
ok( form.find(".errorContainer label.error").is(":hidden") );
|
||||
});
|
||||
|
||||
test("read messages from metadata", function() {
|
||||
var form = $("#testForm9");
|
||||
form.validate();
|
||||
var e = $("#testEmail9");
|
||||
e.valid();
|
||||
equal( form.find("label").text(), "required" );
|
||||
e.val("bla").valid();
|
||||
equal( form.find("label").text(), "email" );
|
||||
});
|
||||
|
||||
|
||||
test("read messages from metadata, with meta option specified, but no metadata in there", function() {
|
||||
var form = $("#testForm1clean");
|
||||
form.validate({
|
||||
meta: "validate",
|
||||
rules: {
|
||||
firstname: "required"
|
||||
}
|
||||
});
|
||||
ok(!form.valid(), "not valid");
|
||||
});
|
||||
@@ -0,0 +1,968 @@
|
||||
(function($) {
|
||||
|
||||
function methodTest( methodName ) {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods[methodName];
|
||||
var element = $("#firstname")[0];
|
||||
return function(value, param) {
|
||||
element.value = value;
|
||||
return method.call( v, value, element, param );
|
||||
};
|
||||
}
|
||||
|
||||
module("methods");
|
||||
|
||||
test("default messages", function() {
|
||||
var m = $.validator.methods;
|
||||
$.each(m, function(key) {
|
||||
ok( jQuery.validator.messages[key], key + " has a default message." );
|
||||
});
|
||||
});
|
||||
|
||||
test("digit", function() {
|
||||
var method = methodTest("digits");
|
||||
ok( method( "123" ), "Valid digits" );
|
||||
ok(!method( "123.000" ), "Invalid digits" );
|
||||
ok(!method( "123.000,00" ), "Invalid digits" );
|
||||
ok(!method( "123.0.0,0" ), "Invalid digits" );
|
||||
ok(!method( "x123" ), "Invalid digits" );
|
||||
ok(!method( "100.100,0,0" ), "Invalid digits" );
|
||||
});
|
||||
|
||||
test("url", function() {
|
||||
var method = methodTest("url");
|
||||
ok( method( "http://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "https://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "ftp://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "http://www.føtex.dk/" ), "Valid url, danish unicode characters" );
|
||||
ok( method( "http://bösendorfer.de/" ), "Valid url, german unicode characters" );
|
||||
ok( method( "http://192.168.8.5" ), "Valid IP Address" );
|
||||
ok(!method( "http://192.168.8." ), "Invalid IP Address" );
|
||||
ok(!method( "http://bassistance" ), "Invalid url" ); // valid
|
||||
ok(!method( "http://bassistance." ), "Invalid url" ); // valid
|
||||
ok(!method( "http://bassistance,de" ), "Invalid url" );
|
||||
ok(!method( "http://bassistance;de" ), "Invalid url" );
|
||||
ok(!method( "http://.bassistancede" ), "Invalid url" );
|
||||
ok(!method( "bassistance.de" ), "Invalid url" );
|
||||
});
|
||||
|
||||
test("url2 (tld optional)", function() {
|
||||
var method = methodTest("url2");
|
||||
ok( method( "http://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "https://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "ftp://bassistance.de/jquery/plugin.php?bla=blu" ), "Valid url" );
|
||||
ok( method( "http://www.føtex.dk/" ), "Valid url, danish unicode characters" );
|
||||
ok( method( "http://bösendorfer.de/" ), "Valid url, german unicode characters" );
|
||||
ok( method( "http://192.168.8.5" ), "Valid IP Address" );
|
||||
ok(!method( "http://192.168.8." ), "Invalid IP Address" );
|
||||
ok( method( "http://bassistance" ), "Invalid url" );
|
||||
ok( method( "http://bassistance." ), "Invalid url" );
|
||||
ok(!method( "http://bassistance,de" ), "Invalid url" );
|
||||
ok(!method( "http://bassistance;de" ), "Invalid url" );
|
||||
ok(!method( "http://.bassistancede" ), "Invalid url" );
|
||||
ok(!method( "bassistance.de" ), "Invalid url" );
|
||||
});
|
||||
|
||||
test("email", function() {
|
||||
var method = methodTest("email");
|
||||
ok( method( "name@domain.tld" ), "Valid email" );
|
||||
ok( method( "name@domain.tl" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.com" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.travel" ), "Valid email" );
|
||||
ok( method( "n@d.tld" ), "Valid email" );
|
||||
ok( method( "ole@føtex.dk"), "Valid email" );
|
||||
ok( method( "jörn@bassistance.de"), "Valid email" );
|
||||
ok( method( "bla.blu@g.mail.com"), "Valid email" );
|
||||
ok( method( "\"Scott Gonzalez\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"Scott González\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"name.\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name,\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name;\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok(!method( "name" ), "Invalid email" );
|
||||
ok(!method( "name@" ), "Invalid email" );
|
||||
ok(!method( "name@domain" ), "Invalid email" );
|
||||
ok(!method( "name.@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name,@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name;@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name;@domain.tld." ), "Invalid email" );
|
||||
});
|
||||
|
||||
test("email2 (tld optional)", function() {
|
||||
var method = methodTest("email2");
|
||||
ok( method( "name@domain.tld" ), "Valid email" );
|
||||
ok( method( "name@domain.tl" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.com" ), "Valid email" );
|
||||
ok( method( "bart+bart@tokbox.travel" ), "Valid email" );
|
||||
ok( method( "n@d.tld" ), "Valid email" );
|
||||
ok( method( "ole@føtex.dk"), "Valid email" );
|
||||
ok( method( "jörn@bassistance.de"), "Valid email" );
|
||||
ok( method( "bla.blu@g.mail.com"), "Valid email" );
|
||||
ok( method( "\"Scott Gonzalez\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"Scott González\"@example.com" ), "Valid email" );
|
||||
ok( method( "\"name.\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name,\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok( method( "\"name;\"@domain.tld" ), "Valid email" ); // valid without top label
|
||||
ok(!method( "name" ), "Invalid email" );
|
||||
ok(!method( "name@" ), "Invalid email" );
|
||||
ok( method( "name@domain" ), "Invalid email" );
|
||||
ok(!method( "name.@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name,@domain.tld" ), "Invalid email" );
|
||||
ok(!method( "name;@domain.tld" ), "Invalid email" );
|
||||
});
|
||||
|
||||
test("number", function() {
|
||||
var method = methodTest("number");
|
||||
ok( method( "123" ), "Valid number" );
|
||||
ok( method( "-123" ), "Valid number" );
|
||||
ok( method( "123,000" ), "Valid number" );
|
||||
ok( method( "-123,000" ), "Valid number" );
|
||||
ok( method( "123,000.00" ), "Valid number" );
|
||||
ok( method( "-123,000.00" ), "Valid number" );
|
||||
ok(!method( "123.000,00" ), "Invalid number" );
|
||||
ok(!method( "123.0.0,0" ), "Invalid number" );
|
||||
ok(!method( "x123" ), "Invalid number" );
|
||||
ok(!method( "100.100,0,0" ), "Invalid number" );
|
||||
|
||||
ok( method( "" ), "Blank is valid" );
|
||||
ok( method( "123" ), "Valid decimal" );
|
||||
ok( method( "123000" ), "Valid decimal" );
|
||||
ok( method( "123000.12" ), "Valid decimal" );
|
||||
ok( method( "-123000.12" ), "Valid decimal" );
|
||||
ok( method( "123.000" ), "Valid decimal" );
|
||||
ok( method( "123,000.00" ), "Valid decimal" );
|
||||
ok( method( "-123,000.00" ), "Valid decimal" );
|
||||
ok( method( ".100" ), "Valid decimal" );
|
||||
ok(!method( "1230,000.00" ), "Invalid decimal" );
|
||||
ok(!method( "123.0.0,0" ), "Invalid decimal" );
|
||||
ok(!method( "x123" ), "Invalid decimal" );
|
||||
ok(!method( "100.100,0,0" ), "Invalid decimal" );
|
||||
});
|
||||
|
||||
/* disabled for now, need to figure out how to test localized methods
|
||||
test("numberDE", function() {
|
||||
var method = methodTest("numberDE");
|
||||
ok( method( "123" ), "Valid numberDE" );
|
||||
ok( method( "-123" ), "Valid numberDE" );
|
||||
ok( method( "123.000" ), "Valid numberDE" );
|
||||
ok( method( "-123.000" ), "Valid numberDE" );
|
||||
ok( method( "123.000,00" ), "Valid numberDE" );
|
||||
ok( method( "-123.000,00" ), "Valid numberDE" );
|
||||
ok(!method( "123,000.00" ), "Invalid numberDE" );
|
||||
ok(!method( "123,0,0.0" ), "Invalid numberDE" );
|
||||
ok(!method( "x123" ), "Invalid numberDE" );
|
||||
ok(!method( "100,100.0.0" ), "Invalid numberDE" );
|
||||
|
||||
ok( method( "" ), "Blank is valid" );
|
||||
ok( method( "123" ), "Valid decimalDE" );
|
||||
ok( method( "123000" ), "Valid decimalDE" );
|
||||
ok( method( "123000,12" ), "Valid decimalDE" );
|
||||
ok( method( "-123000,12" ), "Valid decimalDE" );
|
||||
ok( method( "123.000" ), "Valid decimalDE" );
|
||||
ok( method( "123.000,00" ), "Valid decimalDE" );
|
||||
ok( method( "-123.000,00" ), "Valid decimalDE" )
|
||||
ok(!method( "123.0.0,0" ), "Invalid decimalDE" );
|
||||
ok(!method( "x123" ), "Invalid decimalDE" );
|
||||
ok(!method( "100,100.0.0" ), "Invalid decimalDE" );
|
||||
});
|
||||
*/
|
||||
|
||||
test("date", function() {
|
||||
var method = methodTest("date");
|
||||
ok( method( "06/06/1990" ), "Valid date" );
|
||||
ok( method( "6/6/06" ), "Valid date" );
|
||||
ok(!method( "1990x-06-06" ), "Invalid date" );
|
||||
});
|
||||
|
||||
test("dateISO", function() {
|
||||
var method = methodTest("dateISO");
|
||||
ok( method( "1990-06-06" ), "Valid date" );
|
||||
ok( method( "1990/06/06" ), "Valid date" );
|
||||
ok( method( "1990-6-6" ), "Valid date" );
|
||||
ok( method( "1990/6/6" ), "Valid date" );
|
||||
ok(!method( "1990-106-06" ), "Invalid date" );
|
||||
ok(!method( "190-06-06" ), "Invalid date" );
|
||||
});
|
||||
|
||||
/* disabled for now, need to figure out how to test localized methods
|
||||
test("dateDE", function() {
|
||||
var method = methodTest("dateDE");
|
||||
ok( method( "03.06.1984" ), "Valid dateDE" );
|
||||
ok( method( "3.6.84" ), "Valid dateDE" );
|
||||
ok(!method( "6-6-06" ), "Invalid dateDE" );
|
||||
ok(!method( "1990-06-06" ), "Invalid dateDE" );
|
||||
ok(!method( "06/06/1990" ), "Invalid dateDE" );
|
||||
ok(!method( "6/6/06" ), "Invalid dateDE" );
|
||||
});
|
||||
*/
|
||||
|
||||
test("required", function() {
|
||||
var v = jQuery("#form").validate(),
|
||||
method = $.validator.methods.required,
|
||||
e = $('#text1, #text1b, #hidden2, #select1, #select2');
|
||||
ok( method.call( v, e[0].value, e[0]), "Valid text input" );
|
||||
ok(!method.call( v, e[1].value, e[1]), "Invalid text input" );
|
||||
ok(!method.call( v, e[1].value, e[2]), "Invalid text input" );
|
||||
|
||||
ok(!method.call( v, e[2].value, e[3]), "Invalid select" );
|
||||
ok( method.call( v, e[3].value, e[4]), "Valid select" );
|
||||
|
||||
e = $('#area1, #area2, #pw1, #pw2');
|
||||
ok( method.call( v, e[0].value, e[0]), "Valid textarea" );
|
||||
ok(!method.call( v, e[1].value, e[1]), "Invalid textarea" );
|
||||
ok( method.call( v, e[2].value, e[2]), "Valid password input" );
|
||||
ok(!method.call( v, e[3].value, e[3]), "Invalid password input" );
|
||||
|
||||
e = $('#radio1, #radio2, #radio3');
|
||||
ok(!method.call( v, e[0].value, e[0]), "Invalid radio" );
|
||||
ok( method.call( v, e[1].value, e[1]), "Valid radio" );
|
||||
ok( method.call( v, e[2].value, e[2]), "Valid radio" );
|
||||
|
||||
e = $('#check1, #check2');
|
||||
ok( method.call( v, e[0].value, e[0]), "Valid checkbox" );
|
||||
ok(!method.call( v, e[1].value, e[1]), "Invalid checkbox" );
|
||||
|
||||
e = $('#select1, #select2, #select3, #select4');
|
||||
ok(!method.call( v, e[0].value, e[0]), "Invalid select" );
|
||||
ok( method.call( v, e[1].value, e[1]), "Valid select" );
|
||||
ok( method.call( v, e[2].value, e[2]), "Valid select" );
|
||||
ok( method.call( v, e[3].value, e[3]), "Valid select" );
|
||||
});
|
||||
|
||||
test("required with dependencies", function() {
|
||||
var v = jQuery("#form").validate(),
|
||||
method = $.validator.methods.required,
|
||||
e = $('#hidden2, #select1, #area2, #radio1, #check2');
|
||||
ok( method.call( v, e[0].value, e[0], "asffsaa" ), "Valid text input due to dependency not met" );
|
||||
ok(!method.call( v, e[0].value, e[0], "input" ), "Invalid text input" );
|
||||
ok( method.call( v, e[0].value, e[0], function() { return false; }), "Valid text input due to dependency not met" );
|
||||
ok(!method.call( v, e[0].value, e[0], function() { return true; }), "Invalid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], "asfsfa" ), "Valid select due to dependency not met" );
|
||||
ok(!method.call( v, e[1].value, e[1], "input" ), "Invalid select" );
|
||||
ok( method.call( v, e[2].value, e[2], "asfsafsfa" ), "Valid textarea due to dependency not met" );
|
||||
ok(!method.call( v, e[2].value, e[2], "input" ), "Invalid textarea" );
|
||||
ok( method.call( v, e[3].value, e[3], "asfsafsfa" ), "Valid radio due to dependency not met" );
|
||||
ok(!method.call( v, e[3].value, e[3], "input" ), "Invalid radio" );
|
||||
ok( method.call( v, e[4].value, e[4], "asfsafsfa" ), "Valid checkbox due to dependency not met" );
|
||||
ok(!method.call( v, e[4].value, e[4], "input" ), "Invalid checkbox" );
|
||||
});
|
||||
|
||||
test("minlength", function() {
|
||||
var v = jQuery("#form").validate(),
|
||||
method = $.validator.methods.minlength,
|
||||
param = 2,
|
||||
e = $('#text1, #text1c, #text2, #text3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
ok( method.call( v, e[3].value, e[3], param), "Valid text input" );
|
||||
|
||||
e = $('#check1, #check2, #check3');
|
||||
ok(!method.call( v, e[0].value, e[0], param), "Valid checkbox" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid checkbox" );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Invalid checkbox" );
|
||||
|
||||
e = $('#select1, #select2, #select3, #select4, #select5');
|
||||
ok(method.call( v, e[0].value, e[0], param), "Valid select " + e[0].id );
|
||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid select " + e[1].id );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Valid select " + e[2].id );
|
||||
ok( method.call( v, e[3].value, e[3], param), "Valid select " + e[3].id );
|
||||
ok( method.call( v, e[4].value, e[4], param), "Valid select " + e[4].id );
|
||||
});
|
||||
|
||||
test("maxlength", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.maxlength,
|
||||
param = 4,
|
||||
e = $('#text1, #text2, #text3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
|
||||
e = $('#check1, #check2, #check3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid checkbox" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Invalid checkbox" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid checkbox" );
|
||||
|
||||
e = $('#select1, #select2, #select3, #select4');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid select" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid select" );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Valid select" );
|
||||
ok(!method.call( v, e[3].value, e[3], param), "Invalid select" );
|
||||
});
|
||||
|
||||
test("rangelength", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.rangelength,
|
||||
param = [2, 4],
|
||||
e = $('#text1, #text2, #text3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok(!method.call( v, e[1].value, e[1], param), "Invalid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
});
|
||||
|
||||
test("min", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.min,
|
||||
param = 8,
|
||||
e = $('#value1, #value2, #value3');
|
||||
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok( method.call( v, e[2].value, e[2], param), "Valid text input" );
|
||||
});
|
||||
|
||||
test("max", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.max,
|
||||
param = 12,
|
||||
e = $('#value1, #value2, #value3');
|
||||
ok( method.call( v, e[0].value, e[0], param), "Valid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
});
|
||||
|
||||
test("range", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.range,
|
||||
param = [4,12],
|
||||
e = $('#value1, #value2, #value3');
|
||||
ok(!method.call( v, e[0].value, e[0], param), "Invalid text input" );
|
||||
ok( method.call( v, e[1].value, e[1], param), "Valid text input" );
|
||||
ok(!method.call( v, e[2].value, e[2], param), "Invalid text input" );
|
||||
});
|
||||
|
||||
test("equalTo", function() {
|
||||
var v = jQuery("#form").validate();
|
||||
var method = $.validator.methods.equalTo,
|
||||
e = $('#text1, #text2');
|
||||
ok( method.call( v, "Test", e[0], "#text1" ), "Text input" );
|
||||
ok( method.call( v, "T", e[1], "#text2" ), "Another one" );
|
||||
});
|
||||
|
||||
test("creditcard", function() {
|
||||
var method = methodTest("creditcard");
|
||||
ok( method( "446-667-651" ), "Valid creditcard number" );
|
||||
ok( method( "446 667 651" ), "Valid creditcard number" );
|
||||
ok(!method( "asdf" ), "Invalid creditcard number" );
|
||||
});
|
||||
|
||||
test("extension", function() {
|
||||
var method = methodTest("extension");
|
||||
ok( method( "picture.gif" ), "Valid default accept type" );
|
||||
ok( method( "picture.jpg" ), "Valid default accept type" );
|
||||
ok( method( "picture.jpeg" ), "Valid default accept type" );
|
||||
ok( method( "picture.png" ), "Valid default accept type" );
|
||||
ok(!method( "picture.pgn" ), "Invalid default accept type" );
|
||||
|
||||
var v = jQuery("#form").validate();
|
||||
method = function(value, param) {
|
||||
return $.validator.methods.extension.call(v, value, $('#text1')[0], param);
|
||||
};
|
||||
ok( method( "picture.doc", "doc" ), "Valid custom accept type" );
|
||||
ok( method( "picture.pdf", "doc|pdf" ), "Valid custom accept type" );
|
||||
ok( method( "picture.pdf", "pdf|doc" ), "Valid custom accept type" );
|
||||
ok(!method( "picture.pdf", "doc" ), "Invalid custom accept type" );
|
||||
ok(!method( "picture.doc", "pdf" ), "Invalid custom accept type" );
|
||||
|
||||
ok( method( "picture.pdf", "doc,pdf" ), "Valid custom accept type, comma seperated" );
|
||||
ok( method( "picture.pdf", "pdf,doc" ), "Valid custom accept type, comma seperated" );
|
||||
ok(!method( "picture.pdf", "gop,top" ), "Invalid custom accept type, comma seperated" );
|
||||
});
|
||||
|
||||
test("remote", function() {
|
||||
expect(7);
|
||||
stop();
|
||||
var e = $("#username");
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: "users.php"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
username: {
|
||||
required: "Please",
|
||||
remote: jQuery.validator.format("{0} in use")
|
||||
}
|
||||
},
|
||||
submitHandler: function() {
|
||||
ok( false, "submitHandler may never be called when validating only elements");
|
||||
}
|
||||
});
|
||||
$(document).ajaxStop(function() {
|
||||
$(document).unbind("ajaxStop");
|
||||
equal( 1, v.size(), "There must be one error" );
|
||||
equal( "Peter in use", v.errorList[0].message );
|
||||
|
||||
$(document).ajaxStop(function() {
|
||||
$(document).unbind("ajaxStop");
|
||||
equal( 1, v.size(), "There must be one error" );
|
||||
equal( "Peter2 in use", v.errorList[0].message );
|
||||
start();
|
||||
});
|
||||
e.val("Peter2");
|
||||
strictEqual( v.element(e), true, "new value, new request; dependency-mismatch considered as valid though" );
|
||||
});
|
||||
strictEqual( v.element(e), false, "invalid element, nothing entered yet" );
|
||||
e.val("Peter");
|
||||
strictEqual( v.element(e), true, "still invalid, because remote validation must block until it returns; dependency-mismatch considered as valid though" );
|
||||
});
|
||||
|
||||
test("remote, customized ajax options", function() {
|
||||
expect(2);
|
||||
stop();
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: {
|
||||
url: "users.php",
|
||||
type: "POST",
|
||||
beforeSend: function(request, settings) {
|
||||
deepEqual(settings.type, "POST");
|
||||
deepEqual(settings.data, "username=asdf&email=email.com");
|
||||
},
|
||||
data: {
|
||||
email: function() {
|
||||
return "email.com";
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#username").val("asdf");
|
||||
$("#userForm").valid();
|
||||
});
|
||||
|
||||
|
||||
test("remote extensions", function() {
|
||||
expect(5);
|
||||
stop();
|
||||
var e = $("#username");
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: "users2.php"
|
||||
}
|
||||
},
|
||||
messages: {
|
||||
username: {
|
||||
required: "Please"
|
||||
}
|
||||
},
|
||||
submitHandler: function() {
|
||||
ok( false, "submitHandler may never be called when validating only elements");
|
||||
}
|
||||
});
|
||||
$(document).ajaxStop(function() {
|
||||
$(document).unbind("ajaxStop");
|
||||
equal( 1, v.size(), "There must be one error" );
|
||||
equal( v.errorList[0].message, "asdf is already taken, please try something else" );
|
||||
v.element(e);
|
||||
equal( v.errorList[0].message, "asdf is already taken, please try something else", "message doesn't change on revalidation" );
|
||||
start();
|
||||
});
|
||||
strictEqual( v.element(e), false, "invalid element, nothing entered yet" );
|
||||
e.val("asdf");
|
||||
strictEqual( v.element(e), true, "still invalid, because remote validation must block until it returns; dependency-mismatch considered as valid though" );
|
||||
});
|
||||
|
||||
test("remote radio correct value sent", function() {
|
||||
expect(1);
|
||||
stop();
|
||||
var e = $("#testForm10Radio2");
|
||||
e.attr('checked', 'checked');
|
||||
var v = $("#testForm10").validate({
|
||||
rules: {
|
||||
testForm10Radio: {
|
||||
required: true,
|
||||
remote: {
|
||||
url: "echo.php",
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
equal( data['testForm10Radio'], '2', ' correct radio value sent' );
|
||||
start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
v.element(e);
|
||||
});
|
||||
|
||||
test("remote reset clear old value", function() {
|
||||
expect(1);
|
||||
stop();
|
||||
var e = $("#username");
|
||||
var v = $("#userForm").validate({
|
||||
rules: {
|
||||
username: {
|
||||
required: true,
|
||||
remote: {
|
||||
url: "echo.php",
|
||||
dataFilter: function(data) {
|
||||
var json = JSON.parse(data);
|
||||
if(json.username === 'asdf') {
|
||||
return "\"asdf is already taken\"";
|
||||
}
|
||||
return "\"" + true + "\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
$(document).ajaxStop(function() {
|
||||
var waitTimeout;
|
||||
|
||||
$(document).unbind("ajaxStop");
|
||||
|
||||
|
||||
$(document).ajaxStop(function() {
|
||||
clearTimeout(waitTimeout);
|
||||
ok( true, "Remote request sent to server" );
|
||||
start();
|
||||
});
|
||||
|
||||
|
||||
v.resetForm();
|
||||
e.val("asdf");
|
||||
waitTimeout = setTimeout(function() {
|
||||
ok( false, "Remote server did not get request");
|
||||
start();
|
||||
}, 200);
|
||||
v.element(e);
|
||||
});
|
||||
e.val("asdf");
|
||||
v.element(e);
|
||||
});
|
||||
|
||||
module("additional methods");
|
||||
|
||||
test("phone (us)", function() {
|
||||
var method = methodTest("phoneUS");
|
||||
ok( method( "1(212)-999-2345" ), "Valid us phone number" );
|
||||
ok( method( "212 999 2344" ), "Valid us phone number" );
|
||||
ok( method( "212-999-0983" ), "Valid us phone number" );
|
||||
ok(!method( "111-123-5434" ), "Invalid us phone number" );
|
||||
ok(!method( "212 123 4567" ), "Invalid us phone number" );
|
||||
});
|
||||
|
||||
test("phoneUK", function() {
|
||||
var method = methodTest("phoneUK");
|
||||
ok( method( "07222 555555" ), "Valid UK Phone Number" );
|
||||
ok( method( "(07222) 555555" ), "Valid UK Phone Number" );
|
||||
ok( method( "+44 7222 555 555" ), "Valid UK Phone Number" );
|
||||
ok(!method( "7222 555555" ), "Invalid UK Phone Number" );
|
||||
ok(!method( "+44 07222 555555" ), "Invalid UK Phone Number" );
|
||||
});
|
||||
|
||||
test("mobileUK", function() {
|
||||
var method = methodTest("mobileUK");
|
||||
ok( method( "07734234323" ), "Valid UK Mobile Number" );
|
||||
ok( method( "+447734234323" ), "Valid UK Mobile Number" );
|
||||
ok(!method( "07034234323" ), "Invalid UK Mobile Number" );
|
||||
ok(!method( "0753423432" ), "Invalid UK Mobile Number" );
|
||||
ok(!method( "07604234323" ), "Invalid UK Mobile Number" );
|
||||
ok(!method( "077342343234" ), "Invalid UK Mobile Number" );
|
||||
ok(!method( "044342343234" ), "Invalid UK Mobile Number" );
|
||||
ok(!method( "+44753423432" ), "Invalid UK Mobile Number" );
|
||||
ok(!method( "+447604234323" ), "Invalid UK Mobile Number" );
|
||||
ok(!method( "+4477342343234" ), "Invalid UK Mobile Number" );
|
||||
ok(!method( "+4444342343234" ), "Invalid UK Mobile Number" );
|
||||
});
|
||||
|
||||
test("dateITA", function() {
|
||||
var method = methodTest("dateITA");
|
||||
ok( method( "01/01/1900" ), "Valid date ITA" );
|
||||
ok(!method( "01/13/1990" ), "Invalid date ITA" );
|
||||
ok(!method( "01.01.1900" ), "Invalid date ITA" );
|
||||
ok(!method( "01/01/199" ), "Invalid date ITA" );
|
||||
});
|
||||
|
||||
test("iban", function() {
|
||||
var method = methodTest("iban");
|
||||
ok( method( "NL20INGB0001234567"), "Valid IBAN");
|
||||
ok( method( "DE68 2105 0170 0012 3456 78"), "Valid IBAN");
|
||||
ok( method( "NL20 INGB0001234567"), "Valid IBAN: invalid spacing");
|
||||
ok( method( "NL20 INGB 00 0123 4567"), "Valid IBAN: invalid spacing");
|
||||
ok( method( "XX40INGB000123456712341234"), "Valid (more or less) IBAN: unknown country, but checksum OK");
|
||||
|
||||
ok(!method( "NL20INGB000123456"), "Invalid IBAN: too short");
|
||||
ok(!method( "NL20INGB00012345678"), "Invalid IBAN: too long");
|
||||
ok(!method( "NL20INGB0001234566"), "Invalid IBAN: checksum incorrect");
|
||||
ok(!method( "DE68 2105 0170 0012 3456 7"), "Invalid IBAN: too short");
|
||||
ok(!method( "DE68 2105 0170 0012 3456 789"), "Invalid IBAN: too long");
|
||||
ok(!method( "DE68 2105 0170 0012 3456 79"), "Invalid IBAN: checksum incorrect");
|
||||
|
||||
ok(!method( "NL54INGB00012345671234"), "Invalid IBAN too long, BUT CORRECT CHECKSUM");
|
||||
ok(!method( "XX00INGB000123456712341234"), "Invalid IBAN: unknown country and checksum incorrect");
|
||||
|
||||
// sample IBANs for different countries
|
||||
ok( method( "AL47 2121 1009 0000 0002 3569 8741"), "Valid IBAN - AL");
|
||||
ok( method( "AD12 0001 2030 2003 5910 0100"), "Valid IBAN - AD");
|
||||
ok( method( "AT61 1904 3002 3457 3201"), "Valid IBAN - AT");
|
||||
ok( method( "AZ21 NABZ 0000 0000 1370 1000 1944"), "Valid IBAN - AZ");
|
||||
ok( method( "BH67 BMAG 0000 1299 1234 56"), "Valid IBAN - BH");
|
||||
ok( method( "BE62 5100 0754 7061"), "Valid IBAN - BE");
|
||||
ok( method( "BA39 1290 0794 0102 8494"), "Valid IBAN - BA");
|
||||
ok( method( "BG80 BNBG 9661 1020 3456 78"), "Valid IBAN - BG");
|
||||
ok( method( "HR12 1001 0051 8630 0016 0"), "Valid IBAN - HR");
|
||||
ok( method( "CH93 0076 2011 6238 5295 7"), "Valid IBAN - CH");
|
||||
ok( method( "CY17 0020 0128 0000 0012 0052 7600"), "Valid IBAN - CY");
|
||||
ok( method( "CZ65 0800 0000 1920 0014 5399"), "Valid IBAN - CZ");
|
||||
ok( method( "DK50 0040 0440 1162 43"), "Valid IBAN - DK");
|
||||
ok( method( "EE38 2200 2210 2014 5685"), "Valid IBAN - EE");
|
||||
ok( method( "FO97 5432 0388 8999 44"), "Valid IBAN - FO");
|
||||
ok( method( "FI21 1234 5600 0007 85"), "Valid IBAN - FI");
|
||||
ok( method( "FR14 2004 1010 0505 0001 3M02 606"), "Valid IBAN - FR");
|
||||
ok( method( "GE29 NB00 0000 0101 9049 17"), "Valid IBAN - GE");
|
||||
ok( method( "DE89 3704 0044 0532 0130 00"), "Valid IBAN - DE");
|
||||
ok( method( "GI75 NWBK 0000 0000 7099 453"), "Valid IBAN - GI");
|
||||
ok( method( "GR16 0110 1250 0000 0001 2300 695"), "Valid IBAN - GR");
|
||||
ok( method( "GL56 0444 9876 5432 10"), "Valid IBAN - GL");
|
||||
ok( method( "HU42 1177 3016 1111 1018 0000 0000"), "Valid IBAN - HU");
|
||||
ok( method( "IS14 0159 2600 7654 5510 7303 39"), "Valid IBAN - IS");
|
||||
ok( method( "IE29 AIBK 9311 5212 3456 78"), "Valid IBAN - IE");
|
||||
ok( method( "IL62 0108 0000 0009 9999 999"), "Valid IBAN - IL");
|
||||
ok( method( "IT40 S054 2811 1010 0000 0123 456"), "Valid IBAN - IT");
|
||||
ok( method( "LV80 BANK 0000 4351 9500 1"), "Valid IBAN - LV");
|
||||
ok( method( "LB62 0999 0000 0001 0019 0122 9114"), "Valid IBAN - LB");
|
||||
ok( method( "LI21 0881 0000 2324 013A A"), "Valid IBAN - LI");
|
||||
ok( method( "LT12 1000 0111 0100 1000"), "Valid IBAN - LT");
|
||||
ok( method( "LU28 0019 4006 4475 0000"), "Valid IBAN - LU");
|
||||
ok( method( "MK07 2501 2000 0058 984"), "Valid IBAN - MK");
|
||||
ok( method( "MT84 MALT 0110 0001 2345 MTLC AST0 01S"), "Valid IBAN - MT");
|
||||
ok( method( "MU17 BOMM 0101 1010 3030 0200 000M UR"), "Valid IBAN - MU");
|
||||
ok( method( "MD24 AG00 0225 1000 1310 4168"), "Valid IBAN - MD");
|
||||
ok( method( "MC93 2005 2222 1001 1223 3M44 555"), "Valid IBAN - MC");
|
||||
ok( method( "ME25 5050 0001 2345 6789 51"), "Valid IBAN - ME");
|
||||
ok( method( "NL39 RABO 0300 0652 64"), "Valid IBAN - NL");
|
||||
ok( method( "NO93 8601 1117 947"), "Valid IBAN - NO");
|
||||
ok( method( "PK36 SCBL 0000 0011 2345 6702"), "Valid IBAN - PK");
|
||||
ok( method( "PL60 1020 1026 0000 0422 7020 1111"), "Valid IBAN - PL");
|
||||
ok( method( "PT50 0002 0123 1234 5678 9015 4"), "Valid IBAN - PT");
|
||||
ok( method( "RO49 AAAA 1B31 0075 9384 0000"), "Valid IBAN - RO");
|
||||
ok( method( "SM86 U032 2509 8000 0000 0270 100"), "Valid IBAN - SM");
|
||||
ok( method( "SA03 8000 0000 6080 1016 7519"), "Valid IBAN - SA");
|
||||
ok( method( "RS35 2600 0560 1001 6113 79"), "Valid IBAN - RS");
|
||||
ok( method( "SK31 1200 0000 1987 4263 7541"), "Valid IBAN - SK");
|
||||
ok( method( "SI56 1910 0000 0123 438"), "Valid IBAN - SI");
|
||||
ok( method( "ES80 2310 0001 1800 0001 2345"), "Valid IBAN - ES");
|
||||
ok( method( "SE35 5000 0000 0549 1000 0003"), "Valid IBAN - SE");
|
||||
ok( method( "CH93 0076 2011 6238 5295 7"), "Valid IBAN - CH");
|
||||
ok( method( "TN59 1000 6035 1835 9847 8831"), "Valid IBAN - TN");
|
||||
ok( method( "TR33 0006 1005 1978 6457 8413 26"), "Valid IBAN - TR");
|
||||
ok( method( "AE07 0331 2345 6789 0123 456"), "Valid IBAN - AE");
|
||||
ok( method( "GB29 NWBK 6016 1331 9268 19"), "Valid IBAN - GB");
|
||||
});
|
||||
|
||||
test("postcodeUK", function() {
|
||||
var method = methodTest("postcodeUK");
|
||||
ok( method( "AA9A 9AA" ), "Valid postcode" );
|
||||
ok( method( "A9A 9AA" ), "Valid postcode" );
|
||||
ok( method( "A9 9AA" ), "Valid postcode" );
|
||||
ok( method( "A99 9AA" ), "Valid postcode" );
|
||||
ok( method( "AA9 9AA" ), "Valid postcode" );
|
||||
ok( method( "AA99 9AA" ), "Valid postcode" );
|
||||
|
||||
// Channel Island
|
||||
ok(!method( "AAAA 9AA" ), "Invalid postcode" );
|
||||
ok(!method( "AA-2640" ), "Invalid postcode" );
|
||||
|
||||
ok(!method( "AAA AAA" ), "Invalid postcode" );
|
||||
ok(!method( "AA AAAA" ), "Invalid postcode" );
|
||||
ok(!method( "A AAAA" ), "Invalid postcode" );
|
||||
ok(!method( "AAAAA" ), "Invalid postcode" );
|
||||
ok(!method( "999 999" ), "Invalid postcode" );
|
||||
ok(!method( "99 9999" ), "Invalid postcode" );
|
||||
ok(!method( "9 9999" ), "Invalid postcode" );
|
||||
ok(!method( "99999" ), "Invalid postcode" );
|
||||
});
|
||||
|
||||
test("dateNL", function() {
|
||||
var method = methodTest("dateNL");
|
||||
ok( method( "01-01-1900" ), "Valid date NL" );
|
||||
ok( method( "01.01.1900" ), "Valid date NL" );
|
||||
ok( method( "01/01/1900" ), "Valid date NL" );
|
||||
ok( method( "01-01-00" ), "Valid date NL" );
|
||||
ok( method( "1-01-1900" ), "Valid date NL" );
|
||||
ok( method( "10-10-1900" ), "Valid date NL" );
|
||||
ok(!method( "0-01-1900" ), "Invalid date NL" );
|
||||
ok(!method( "00-01-1900" ), "Invalid date NL" );
|
||||
ok(!method( "35-01-1990" ), "Invalid date NL" );
|
||||
ok(!method( "01.01.190" ), "Invalid date NL" );
|
||||
});
|
||||
|
||||
test("phoneNL", function() {
|
||||
var method = methodTest("phoneNL");
|
||||
ok( method( "0701234567"), "Valid phone NL");
|
||||
ok( method( "0687654321"), "Valid phone NL");
|
||||
ok( method( "020-1234567"), "Valid phone NL");
|
||||
ok( method( "020 - 12 34 567"), "Valid phone NL");
|
||||
ok( method( "010-2345678"), "Valid phone NL");
|
||||
ok( method( "+3120-1234567"), "Valid phone NL");
|
||||
ok( method( "+31(0)10-2345678"), "Valid phone NL");
|
||||
ok(!method( "020-123456"), "Invalid phone NL: too short");
|
||||
ok(!method( "020-12345678"), "Invalid phone NL: too long");
|
||||
ok(!method( "-0201234567"), "Invalid phone NL");
|
||||
ok(!method( "+310201234567"), "Invalid phone NL: no 0 after +31 allowed");
|
||||
});
|
||||
|
||||
test("mobileNL", function() {
|
||||
var method = methodTest("mobileNL");
|
||||
ok( method( "0612345678"), "Valid NL Mobile Number");
|
||||
ok( method( "06-12345678"), "Valid NL Mobile Number");
|
||||
ok( method( "06-12 345 678"), "Valid NL Mobile Number");
|
||||
ok( method( "+316-12345678"), "Valid NL Mobile Number");
|
||||
ok( method( "+31(0)6-12345678"), "Valid NL Mobile Number");
|
||||
ok(!method( "abcdefghij"), "Invalid NL Mobile Number: text");
|
||||
ok(!method( "0123456789"), "Invalid NL Mobile Number: should start with 06");
|
||||
ok(!method( "0823456789"), "Invalid NL Mobile Number: should start with 06");
|
||||
ok(!method( "06-1234567"), "Invalid NL Mobile Number: too short");
|
||||
ok(!method( "06-123456789"), "Invalid NL Mobile Number: too long");
|
||||
ok(!method( "-0612345678"), "Invalid NL Mobile Number");
|
||||
ok(!method( "+310612345678"), "Invalid NL Mobile Number: no 0 after +31 allowed");
|
||||
});
|
||||
|
||||
test("postalcodeNL", function() {
|
||||
var method = methodTest("postalcodeNL");
|
||||
ok( method( "1234AB"), "Valid NL Postal Code");
|
||||
ok( method( "1234ab"), "Valid NL Postal Code");
|
||||
ok( method( "1234 AB"), "Valid NL Postal Code");
|
||||
ok( method( "6789YZ"), "Valid NL Postal Code");
|
||||
ok(!method( "123AA"), "Invalid NL Postal Code: not enough digits");
|
||||
ok(!method( "12345ZZ"), "Invalid NL Postal Code: too many digits");
|
||||
ok(!method( "1234 AA"), "Invalid NL Postal Code: too many spaces");
|
||||
ok(!method( "AA1234"), "Invalid NL Postal Code");
|
||||
ok(!method( "1234-AA"), "Invalid NL Postal Code");
|
||||
});
|
||||
|
||||
test("bankaccountNL", function() {
|
||||
var method = methodTest("bankaccountNL");
|
||||
ok( method( "755490975"), "Valid NL bank account");
|
||||
ok( method( "75 54 90 975"), "Valid NL bank account");
|
||||
ok( method( "123456789"), "Valid NL bank account");
|
||||
ok( method( "12 34 56 789"), "Valid NL bank account");
|
||||
ok(!method( "12 3456789"), "Valid NL bank account: inconsistent spaces");
|
||||
ok(!method( "123 45 67 89"), "Valid NL bank account: incorrect spaces");
|
||||
ok(!method( "755490971"), "Invalid NL bank account");
|
||||
ok(!method( "755490973"), "Invalid NL bank account");
|
||||
ok(!method( "755490979"), "Invalid NL bank account");
|
||||
ok(!method( "123456781"), "Invalid NL bank account");
|
||||
ok(!method( "123456784"), "Invalid NL bank account");
|
||||
ok(!method( "123456788"), "Invalid NL bank account");
|
||||
});
|
||||
|
||||
test("giroaccountNL", function() {
|
||||
var method = methodTest("giroaccountNL");
|
||||
ok( method( "123"), "Valid NL giro account");
|
||||
ok( method( "1234567"), "Valid NL giro account");
|
||||
ok(!method( "123456788"), "Invalid NL giro account");
|
||||
});
|
||||
|
||||
test("bankorgiroaccountNL", function() {
|
||||
var method = methodTest("bankorgiroaccountNL");
|
||||
ok( method( "123"), "Valid NL giro account");
|
||||
ok( method( "1234567"), "Valid NL giro account");
|
||||
ok( method( "123456789"), "Valid NL bank account");
|
||||
ok(!method( "12345678"), "Invalid NL bank or giro account");
|
||||
ok(!method( "123456788"), "Invalid NL bank or giro account");
|
||||
});
|
||||
|
||||
test("time", function() {
|
||||
var method = methodTest("time");
|
||||
ok( method( "00:00" ), "Valid time, lower bound" );
|
||||
ok( method( "23:59" ), "Valid time, upper bound" );
|
||||
ok(!method( "12" ), "Invalid time" );
|
||||
ok(!method( "29:59" ), "Invalid time" );
|
||||
ok(!method( "00:60" ), "Invalid time" );
|
||||
ok(!method( "24:60" ), "Invalid time" );
|
||||
ok(!method( "24:00" ), "Invalid time" );
|
||||
ok(!method( "30:00" ), "Invalid time" );
|
||||
ok(!method( "29:59" ), "Invalid time" );
|
||||
ok(!method( "120:00" ), "Invalid time" );
|
||||
ok(!method( "12:001" ), "Invalid time" );
|
||||
ok(!method( "12:00a" ), "Invalid time" );
|
||||
});
|
||||
|
||||
test("time12h", function() {
|
||||
var method = methodTest("time12h");
|
||||
ok( method( "12:00 AM" ), "Valid time, lower bound, am" );
|
||||
ok( method( "11:59 AM" ), "Valid time, upper bound, am" );
|
||||
ok( method( "12:00AM" ), "Valid time, no space, am" );
|
||||
ok( method( "12:00PM" ), "Valid time, no space, pm" );
|
||||
ok( method( "12:00 PM" ), "Valid time, lower bound, pm" );
|
||||
ok( method( "11:59 PM" ), "Valid time, upper bound, pm" );
|
||||
ok( method( "11:59 am" ), "Valid time, also accept lowercase" );
|
||||
ok( method( "11:59 pm" ), "Valid time, also accept lowercase" );
|
||||
ok( method( "1:59 pm" ), "Valid time, single hour, no leading 0" );
|
||||
ok( method( "01:59 pm" ), "Valid time, single hour, leading 0" );
|
||||
ok(!method( "12:00" ), "Invalid time" );
|
||||
ok(!method( "9" ), "Invalid time" );
|
||||
ok(!method( "9 am"), "Invalid time" );
|
||||
ok(!method( "12:61 am" ), "Invalid time" );
|
||||
ok(!method( "13:00 am" ), "Invalid time" );
|
||||
ok(!method( "00:00 am" ), "Invalid time" );
|
||||
});
|
||||
|
||||
test("minWords", function() {
|
||||
var method = methodTest("minWords");
|
||||
ok( method( "hello worlds", 2 ), "plain text, valid" );
|
||||
ok( method( "<b>hello</b> world", 2 ), "html, valid" );
|
||||
ok(!method( "hello", 2 ), "plain text, invalid" );
|
||||
ok(!method( "<b>world</b>", 2 ), "html, invalid" );
|
||||
ok(!method( "world <br/>", 2 ), "html, invalid" );
|
||||
});
|
||||
|
||||
test("maxWords", function() {
|
||||
var method = methodTest("maxWords");
|
||||
ok( method( "hello", 2 ), "plain text, valid" );
|
||||
ok( method( "<b>world</b>", 2 ), "html, valid" );
|
||||
ok( method( "world <br/>", 2 ), "html, valid" );
|
||||
ok( method( "hello worlds", 2 ), "plain text, valid" );
|
||||
ok( method( "<b>hello</b> world", 2 ), "html, valid" );
|
||||
ok(!method( "hello 123 world", 2 ), "plain text, invalid" );
|
||||
ok(!method( "<b>hello</b> 123 world", 2 ), "html, invalid" );
|
||||
});
|
||||
|
||||
test("rangeWords", function() {
|
||||
var method = methodTest("rangeWords");
|
||||
ok( method( "hello", [0, 2] ), "plain text, valid" );
|
||||
ok( method( "hello worlds", [0, 2] ), "plain text, valid" );
|
||||
ok( method( "<b>hello</b> world", [0, 2] ), "html, valid" );
|
||||
ok(!method( "hello worlds what is up", [0, 2] ), "plain text, invalid" );
|
||||
ok(!method( "<b>Hello</b> <b>world</b> <b>hello</b>", [0, 2] ), "html, invalid" );
|
||||
});
|
||||
|
||||
test("pattern", function() {
|
||||
var method = methodTest("pattern");
|
||||
ok( method( "AR1004", "AR\\d{4}" ), "Correct format for the given RegExp" );
|
||||
ok( method( "AR1004", /^AR\d{4}$/ ), "Correct format for the given RegExp" );
|
||||
ok(!method( "BR1004", /^AR\d{4}$/ ), "Invalid format for the given RegExp" );
|
||||
});
|
||||
|
||||
function testCardTypeByNumber(number, cardname, expected) {
|
||||
$("#cardnumber").val(number);
|
||||
var actual = $("#ccform").valid();
|
||||
equal(actual, expected, $.format("Expect card number {0} to validate to {1}, actually validated to ", number, expected));
|
||||
}
|
||||
|
||||
test('creditcardtypes, all', function() {
|
||||
$("#ccform").validate({
|
||||
rules: {
|
||||
cardnumber: {
|
||||
creditcard: true,
|
||||
creditcardtypes: {
|
||||
all: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
testCardTypeByNumber( "4111-1111-1111-1111", "VISA", true );
|
||||
testCardTypeByNumber( "5111-1111-1111-1118", "MasterCard", true );
|
||||
testCardTypeByNumber( "6111-1111-1111-1116", "Discover", true );
|
||||
testCardTypeByNumber( "3400-0000-0000-009", "AMEX", true );
|
||||
|
||||
testCardTypeByNumber( "4111-1111-1111-1110", "VISA", false );
|
||||
testCardTypeByNumber( "5432-1111-1111-1111", "MasterCard", false );
|
||||
testCardTypeByNumber( "6611-6611-6611-6611", "Discover", false );
|
||||
testCardTypeByNumber( "3777-7777-7777-7777", "AMEX", false );
|
||||
});
|
||||
|
||||
test('creditcardtypes, visa', function() {
|
||||
$("#ccform").validate({
|
||||
rules: {
|
||||
cardnumber: {
|
||||
creditcard: true,
|
||||
creditcardtypes: {
|
||||
visa: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
testCardTypeByNumber( "4111-1111-1111-1111", "VISA", true );
|
||||
testCardTypeByNumber( "5111-1111-1111-1118", "MasterCard", false );
|
||||
testCardTypeByNumber( "6111-1111-1111-1116", "Discover", false );
|
||||
testCardTypeByNumber( "3400-0000-0000-009", "AMEX", false );
|
||||
});
|
||||
|
||||
test('creditcardtypes, mastercard', function() {
|
||||
$("#ccform").validate({
|
||||
rules: {
|
||||
cardnumber: {
|
||||
creditcard: true,
|
||||
creditcardtypes: {
|
||||
mastercard: true
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
testCardTypeByNumber( "5111-1111-1111-1118", "MasterCard", true );
|
||||
testCardTypeByNumber( "6111-1111-1111-1116", "Discover", false );
|
||||
testCardTypeByNumber( "3400-0000-0000-009", "AMEX", false );
|
||||
testCardTypeByNumber( "4111-1111-1111-1111", "VISA", false );
|
||||
});
|
||||
|
||||
function fillFormWithValuesAndExpect(formSelector, inputValues, expected) {
|
||||
for (var i=0; i < inputValues.length; i++) {
|
||||
$(formSelector + ' input:eq(' + i + ')').val(inputValues[i]);
|
||||
}
|
||||
var actual = $(formSelector).valid();
|
||||
equal(actual, expected, $.format("Filled inputs of form '{0}' with {1} values ({2})", formSelector, inputValues.length, inputValues.toString()));
|
||||
|
||||
}
|
||||
|
||||
test('require_from_group', function() {
|
||||
$("#productInfo").validate({
|
||||
rules: {
|
||||
partnumber: {require_from_group: [2,".productInfo"]},
|
||||
description: {require_from_group: [2,".productInfo"]},
|
||||
discount: {require_from_group: [2,".productInfo"]}
|
||||
}
|
||||
});
|
||||
|
||||
fillFormWithValuesAndExpect('#productInfo', [], false);
|
||||
fillFormWithValuesAndExpect('#productInfo', [123], false);
|
||||
$('#productInfo input[type="checkbox"]').attr('checked', 'checked');
|
||||
fillFormWithValuesAndExpect('#productInfo', [123], true);
|
||||
$('#productInfo input[type="checkbox"]').removeAttr('checked');
|
||||
fillFormWithValuesAndExpect('#productInfo', [123, 'widget'], true);
|
||||
fillFormWithValuesAndExpect('#productInfo', [123, 'widget', 'red'], true);
|
||||
fillFormWithValuesAndExpect('#productInfo', [123, 'widget', 'red'], true);
|
||||
});
|
||||
|
||||
test('skip_or_fill_minimum', function() {
|
||||
$("#productInfo").validate({
|
||||
rules: {
|
||||
partnumber: {skip_or_fill_minimum: [2,".productInfo"]},
|
||||
description: {skip_or_fill_minimum: [2,".productInfo"]},
|
||||
color: {skip_or_fill_minimum: [2,".productInfo"]}
|
||||
}
|
||||
});
|
||||
|
||||
fillFormWithValuesAndExpect('#productInfo', [], true);
|
||||
fillFormWithValuesAndExpect('#productInfo', [123], false);
|
||||
fillFormWithValuesAndExpect('#productInfo', [123, 'widget'], true);
|
||||
fillFormWithValuesAndExpect('#productInfo', [123, 'widget', 'red'], true);
|
||||
});
|
||||
|
||||
test("zipcodeUS", function() {
|
||||
var method = methodTest("zipcodeUS");
|
||||
ok( method( "12345" ), "Valid zip" );
|
||||
ok( method( "12345-2345" ), "Valid zip" );
|
||||
ok(!method( "1" ), "Invalid zip" );
|
||||
ok(!method( "1234" ), "Invalid zip" );
|
||||
ok(!method( "123-23" ), "Invalid zip" );
|
||||
ok(!method( "12345-43" ), "Invalid zip" );
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
@@ -0,0 +1,244 @@
|
||||
/**
|
||||
* QUnit v1.11.0 - A JavaScript Unit Testing Framework
|
||||
*
|
||||
* http://qunitjs.com
|
||||
*
|
||||
* Copyright 2012 jQuery Foundation and other contributors
|
||||
* Released under the MIT license.
|
||||
* http://jquery.org/license
|
||||
*/
|
||||
|
||||
/** Font Family and Sizes */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult {
|
||||
font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; }
|
||||
#qunit-tests { font-size: smaller; }
|
||||
|
||||
|
||||
/** Resets */
|
||||
|
||||
#qunit-tests, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult, #qunit-modulefilter {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
/** Header */
|
||||
|
||||
#qunit-header {
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
|
||||
color: #8699a4;
|
||||
background-color: #0d3349;
|
||||
|
||||
font-size: 1.5em;
|
||||
line-height: 1em;
|
||||
font-weight: normal;
|
||||
|
||||
border-radius: 5px 5px 0 0;
|
||||
-moz-border-radius: 5px 5px 0 0;
|
||||
-webkit-border-top-right-radius: 5px;
|
||||
-webkit-border-top-left-radius: 5px;
|
||||
}
|
||||
|
||||
#qunit-header a {
|
||||
text-decoration: none;
|
||||
color: #c2ccd1;
|
||||
}
|
||||
|
||||
#qunit-header a:hover,
|
||||
#qunit-header a:focus {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar label {
|
||||
display: inline-block;
|
||||
padding: 0 .5em 0 .1em;
|
||||
}
|
||||
|
||||
#qunit-banner {
|
||||
height: 5px;
|
||||
}
|
||||
|
||||
#qunit-testrunner-toolbar {
|
||||
padding: 0.5em 0 0.5em 2em;
|
||||
color: #5E740B;
|
||||
background-color: #eee;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#qunit-userAgent {
|
||||
padding: 0.5em 0 0.5em 2.5em;
|
||||
background-color: #2b81af;
|
||||
color: #fff;
|
||||
text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px;
|
||||
}
|
||||
|
||||
#qunit-modulefilter-container {
|
||||
float: right;
|
||||
}
|
||||
|
||||
/** Tests: Pass/Fail */
|
||||
|
||||
#qunit-tests {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests li {
|
||||
padding: 0.4em 0.5em 0.4em 2.5em;
|
||||
border-bottom: 1px solid #fff;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests li strong {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#qunit-tests li a {
|
||||
padding: 0.5em;
|
||||
color: #c2ccd1;
|
||||
text-decoration: none;
|
||||
}
|
||||
#qunit-tests li a:hover,
|
||||
#qunit-tests li a:focus {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
#qunit-tests li .runtime {
|
||||
float: right;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.qunit-assert-list {
|
||||
margin-top: 0.5em;
|
||||
padding: 0.5em;
|
||||
|
||||
background-color: #fff;
|
||||
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
.qunit-collapsed {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#qunit-tests table {
|
||||
border-collapse: collapse;
|
||||
margin-top: .2em;
|
||||
}
|
||||
|
||||
#qunit-tests th {
|
||||
text-align: right;
|
||||
vertical-align: top;
|
||||
padding: 0 .5em 0 0;
|
||||
}
|
||||
|
||||
#qunit-tests td {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#qunit-tests pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#qunit-tests del {
|
||||
background-color: #e0f2be;
|
||||
color: #374e0c;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#qunit-tests ins {
|
||||
background-color: #ffcaca;
|
||||
color: #500;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/*** Test Counts */
|
||||
|
||||
#qunit-tests b.counts { color: black; }
|
||||
#qunit-tests b.passed { color: #5E740B; }
|
||||
#qunit-tests b.failed { color: #710909; }
|
||||
|
||||
#qunit-tests li li {
|
||||
padding: 5px;
|
||||
background-color: #fff;
|
||||
border-bottom: none;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
/*** Passing Styles */
|
||||
|
||||
#qunit-tests li li.pass {
|
||||
color: #3c510c;
|
||||
background-color: #fff;
|
||||
border-left: 10px solid #C6E746;
|
||||
}
|
||||
|
||||
#qunit-tests .pass { color: #528CE0; background-color: #D2E0E6; }
|
||||
#qunit-tests .pass .test-name { color: #366097; }
|
||||
|
||||
#qunit-tests .pass .test-actual,
|
||||
#qunit-tests .pass .test-expected { color: #999999; }
|
||||
|
||||
#qunit-banner.qunit-pass { background-color: #C6E746; }
|
||||
|
||||
/*** Failing Styles */
|
||||
|
||||
#qunit-tests li li.fail {
|
||||
color: #710909;
|
||||
background-color: #fff;
|
||||
border-left: 10px solid #EE5757;
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
#qunit-tests > li:last-child {
|
||||
border-radius: 0 0 5px 5px;
|
||||
-moz-border-radius: 0 0 5px 5px;
|
||||
-webkit-border-bottom-right-radius: 5px;
|
||||
-webkit-border-bottom-left-radius: 5px;
|
||||
}
|
||||
|
||||
#qunit-tests .fail { color: #000000; background-color: #EE5757; }
|
||||
#qunit-tests .fail .test-name,
|
||||
#qunit-tests .fail .module-name { color: #000000; }
|
||||
|
||||
#qunit-tests .fail .test-actual { color: #EE5757; }
|
||||
#qunit-tests .fail .test-expected { color: green; }
|
||||
|
||||
#qunit-banner.qunit-fail { background-color: #EE5757; }
|
||||
|
||||
|
||||
/** Result */
|
||||
|
||||
#qunit-testresult {
|
||||
padding: 0.5em 0.5em 0.5em 2.5em;
|
||||
|
||||
color: #2b81af;
|
||||
background-color: #D2E0E6;
|
||||
|
||||
border-bottom: 1px solid white;
|
||||
}
|
||||
#qunit-testresult .module-name {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/** Fixture */
|
||||
|
||||
#qunit-fixture {
|
||||
position: absolute;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
width: 1000px;
|
||||
height: 1000px;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,277 @@
|
||||
module("rules");
|
||||
|
||||
test("rules() - internal - input", function() {
|
||||
var element = $('#firstname');
|
||||
var v = $('#testForm1').validate();
|
||||
deepEqual( element.rules(), { required: true, minlength: 2 } );
|
||||
});
|
||||
|
||||
test("rules(), ignore method:false", function() {
|
||||
var element = $('#firstnamec');
|
||||
var v = $('#testForm1clean').validate({
|
||||
rules: {
|
||||
firstname: { required: false, minlength: 2 }
|
||||
}
|
||||
});
|
||||
deepEqual( element.rules(), { minlength: 2 } );
|
||||
});
|
||||
|
||||
test("rules() HTML5 required (no value)", function() {
|
||||
var element = $('#testForm11text1');
|
||||
var v = $('#testForm11').validate();
|
||||
deepEqual( element.rules(), { required: true } );
|
||||
});
|
||||
|
||||
test("rules() - internal - select", function() {
|
||||
var element = $('#meal');
|
||||
var v = $('#testForm3').validate();
|
||||
deepEqual( element.rules(), {required: true} );
|
||||
});
|
||||
|
||||
test("rules() - external", function() {
|
||||
var element = $('#text1');
|
||||
var v = $('#form').validate({
|
||||
rules: {
|
||||
action: {date: true, min: 5}
|
||||
}
|
||||
});
|
||||
deepEqual( element.rules(), {date: true, min: 5} );
|
||||
});
|
||||
|
||||
test("rules() - external - complete form", function() {
|
||||
expect(1);
|
||||
|
||||
var methods = $.extend({}, $.validator.methods);
|
||||
var messages = $.extend({}, $.validator.messages);
|
||||
|
||||
$.validator.addMethod("verifyTest", function() {
|
||||
ok( true, "method executed" );
|
||||
return true;
|
||||
});
|
||||
var v = $('#form').validate({
|
||||
rules: {
|
||||
action: {verifyTest: true}
|
||||
}
|
||||
});
|
||||
v.form();
|
||||
|
||||
$.validator.methods = methods;
|
||||
$.validator.messages = messages;
|
||||
});
|
||||
|
||||
test("rules() - internal - input", function() {
|
||||
var element = $('#form8input');
|
||||
var v = $('#testForm8').validate();
|
||||
deepEqual( element.rules(), {required: true, number: true, rangelength: [2, 8]});
|
||||
});
|
||||
|
||||
test("rules(), merge min/max to range, minlength/maxlength to rangelength", function() {
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: {
|
||||
min: 5,
|
||||
max: 12
|
||||
},
|
||||
lastname: {
|
||||
minlength: 2,
|
||||
maxlength: 8
|
||||
}
|
||||
}
|
||||
});
|
||||
deepEqual( $("#firstnamec").rules(), {range: [5, 12]});
|
||||
|
||||
deepEqual( $("#lastnamec").rules(), {rangelength: [2, 8]} );
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
});
|
||||
|
||||
test("rules(), guarantee that required is at front", function() {
|
||||
$("#testForm1").validate();
|
||||
var v = $("#v2").validate();
|
||||
$("#subformRequired").validate();
|
||||
function flatRules(element) {
|
||||
var result = [];
|
||||
jQuery.each($(element).rules(), function(key, value) { result.push(key); });
|
||||
return result.join(" ");
|
||||
}
|
||||
equal( "required minlength", flatRules("#firstname") );
|
||||
equal( "required minlength maxlength", flatRules("#v2-i6") );
|
||||
equal( "required maxlength", flatRules("#co_name") );
|
||||
|
||||
QUnit.reset();
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
v = $("#v2").validate();
|
||||
equal( "required rangelength", flatRules("#v2-i6") );
|
||||
|
||||
$("#subformRequired").validate({
|
||||
rules: {
|
||||
co_name: "required"
|
||||
}
|
||||
});
|
||||
$("#co_name").removeClass();
|
||||
equal( "required maxlength", flatRules("#co_name") );
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
});
|
||||
|
||||
test("rules(), evaluate dynamic parameters", function() {
|
||||
expect(2);
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: {
|
||||
min: function(element) {
|
||||
equal( $("#firstnamec")[0], element );
|
||||
return 12;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
deepEqual( $("#firstnamec").rules(), {min:12});
|
||||
});
|
||||
|
||||
test("rules(), class and attribute combinations", function() {
|
||||
|
||||
$.validator.addMethod("customMethod1", function() {
|
||||
return false;
|
||||
}, "");
|
||||
$.validator.addMethod("customMethod2", function() {
|
||||
return false;
|
||||
}, "");
|
||||
var v = $("#v2").validate({
|
||||
rules: {
|
||||
'v2-i7': {
|
||||
required: true,
|
||||
minlength: 2,
|
||||
customMethod: true
|
||||
}
|
||||
}
|
||||
});
|
||||
deepEqual( $("#v2-i1").rules(), { required: true });
|
||||
deepEqual( $("#v2-i2").rules(), { required: true, email: true });
|
||||
deepEqual( $("#v2-i3").rules(), { url: true });
|
||||
deepEqual( $("#v2-i4").rules(), { required: true, minlength: 2 });
|
||||
deepEqual( $("#v2-i5").rules(), { required: true, minlength: 2, maxlength: 5, customMethod1: "123" });
|
||||
jQuery.validator.autoCreateRanges = true;
|
||||
deepEqual( $("#v2-i5").rules(), { required: true, customMethod1: "123", rangelength: [2, 5] });
|
||||
deepEqual( $("#v2-i6").rules(), { required: true, customMethod2: true, rangelength: [2, 5] });
|
||||
jQuery.validator.autoCreateRanges = false;
|
||||
deepEqual( $("#v2-i7").rules(), { required: true, minlength: 2, customMethod: true });
|
||||
|
||||
delete $.validator.methods.customMethod1;
|
||||
delete $.validator.messages.customMethod1;
|
||||
delete $.validator.methods.customMethod2;
|
||||
delete $.validator.messages.customMethod2;
|
||||
});
|
||||
|
||||
test("rules(), dependency checks", function() {
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: {
|
||||
min: {
|
||||
param: 5,
|
||||
depends: function(el) {
|
||||
return (/^a/).test($(el).val());
|
||||
}
|
||||
}
|
||||
},
|
||||
lastname: {
|
||||
max: {
|
||||
param: 12
|
||||
},
|
||||
email: {
|
||||
depends: function() { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var rules = $("#firstnamec").rules();
|
||||
equal( 0, v.objectLength(rules) );
|
||||
|
||||
$("#firstnamec").val('ab');
|
||||
deepEqual( $("#firstnamec").rules(), {min:5});
|
||||
|
||||
deepEqual( $("#lastnamec").rules(), {max:12, email:true});
|
||||
});
|
||||
|
||||
test("rules(), add and remove", function() {
|
||||
$.validator.addMethod("customMethod1", function() {
|
||||
return false;
|
||||
}, "");
|
||||
$("#v2").validate();
|
||||
var removedAttrs = $("#v2-i5").removeClass("required").removeAttrs("minlength maxlength");
|
||||
deepEqual( $("#v2-i5").rules(), { customMethod1: "123" });
|
||||
|
||||
$("#v2-i5").addClass("required").attr(removedAttrs);
|
||||
deepEqual( $("#v2-i5").rules(), { required: true, minlength: 2, maxlength: 5, customMethod1: "123" });
|
||||
|
||||
$("#v2-i5").addClass("email").attr({min: 5});
|
||||
deepEqual( $("#v2-i5").rules(), { required: true, email: true, minlength: 2, maxlength: 5, min: 5, customMethod1: "123" });
|
||||
|
||||
$("#v2-i5").removeClass("required email").removeAttrs("minlength maxlength customMethod1 min");
|
||||
deepEqual( $("#v2-i5").rules(), {});
|
||||
|
||||
delete $.validator.methods.customMethod1;
|
||||
delete $.validator.messages.customMethod1;
|
||||
});
|
||||
|
||||
test("rules(), add and remove static rules", function() {
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: "required date"
|
||||
}
|
||||
});
|
||||
deepEqual( $("#firstnamec").rules(), { required: true, date: true } );
|
||||
|
||||
$("#firstnamec").rules("remove", "date");
|
||||
deepEqual( $("#firstnamec").rules(), { required: true } );
|
||||
$("#firstnamec").rules("add", "email");
|
||||
deepEqual( $("#firstnamec").rules(), { required: true, email: true } );
|
||||
|
||||
$("#firstnamec").rules("remove", "required");
|
||||
deepEqual( $("#firstnamec").rules(), { email: true } );
|
||||
|
||||
deepEqual( $("#firstnamec").rules("remove"), { email: true } );
|
||||
deepEqual( $("#firstnamec").rules(), { } );
|
||||
|
||||
$("#firstnamec").rules("add", "required email");
|
||||
deepEqual( $("#firstnamec").rules(), { required: true, email: true } );
|
||||
|
||||
|
||||
deepEqual( $("#lastnamec").rules(), {} );
|
||||
$("#lastnamec").rules("add", "required");
|
||||
$("#lastnamec").rules("add", {
|
||||
minlength: 2
|
||||
});
|
||||
deepEqual( $("#lastnamec").rules(), { required: true, minlength: 2 } );
|
||||
|
||||
|
||||
var removedRules = $("#lastnamec").rules("remove", "required email");
|
||||
deepEqual( $("#lastnamec").rules(), { minlength: 2 } );
|
||||
$("#lastnamec").rules("add", removedRules);
|
||||
deepEqual( $("#lastnamec").rules(), { required: true, minlength: 2 } );
|
||||
});
|
||||
|
||||
test("rules(), add messages", function() {
|
||||
$("#firstnamec").attr("title", null);
|
||||
var v = $("#testForm1clean").validate({
|
||||
rules: {
|
||||
firstname: "required"
|
||||
}
|
||||
});
|
||||
$("#testForm1clean").valid();
|
||||
$("#firstnamec").valid();
|
||||
deepEqual( v.settings.messages.firstname, undefined );
|
||||
|
||||
$("#firstnamec").rules("add", {
|
||||
messages: {
|
||||
required: "required"
|
||||
}
|
||||
});
|
||||
|
||||
$("#firstnamec").valid();
|
||||
deepEqual( v.errorList[0] && v.errorList[0].message, "required" );
|
||||
|
||||
$("#firstnamec").val("test");
|
||||
$("#firstnamec").valid();
|
||||
equal(v.errorList.length, 0);
|
||||
});
|
||||
@@ -0,0 +1,436 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
||||
<title>Fun with jQuery</title>
|
||||
|
||||
<script src="http://www.google.com/jsapi"></script>
|
||||
<script>
|
||||
google.load("jquery", "1");
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$.fn.options = function(selector) {
|
||||
return this.each(function() {
|
||||
function container(select) {
|
||||
if (select.next().is(".option-container")) {
|
||||
return $(select).next();
|
||||
}
|
||||
return $('<select class="option-container" />').append(select.children()).insertAfter(select).hide();
|
||||
}
|
||||
var container = container($(this));
|
||||
$(this).empty().append(container.children(selector).clone());
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
$("#State").hide()
|
||||
|
||||
$("#Country").change(function() {
|
||||
var selected = this.options[this.selectedIndex].value;
|
||||
if (selected == "US") {
|
||||
$("#State").show().options(".state");
|
||||
} else if (selected == "CA") {
|
||||
$("#State").show().options(".province");
|
||||
} else {
|
||||
$("#State").hide();
|
||||
}
|
||||
}).change();
|
||||
|
||||
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
Mission:
|
||||
|
||||
<xmp>
|
||||
CODE
|
||||
|
||||
</xmp>
|
||||
|
||||
|
||||
<select size="1" id="Country" name="country">
|
||||
<option value="">Select One</option>
|
||||
|
||||
<option value="US" selected="selected">United States</option>
|
||||
<option value="CA">Canada</option>
|
||||
<option value="">----------</option>
|
||||
<option value="AF">Afghanistan</option>
|
||||
<option value="AL">Albania</option>
|
||||
<option value="DZ">Algeria</option>
|
||||
|
||||
<option value="AS">American Samoa</option>
|
||||
<option value="AD">Andorra</option>
|
||||
<option value="AO">Angola</option>
|
||||
<option value="AI">Anguilla</option>
|
||||
<option value="AQ">Antarctica</option>
|
||||
<option value="AG">Antigua and Barbuda</option>
|
||||
|
||||
<option value="AR">Argentina</option>
|
||||
<option value="AM">Armenia</option>
|
||||
<option value="AW">Aruba</option>
|
||||
<option value="AU">Australia</option>
|
||||
<option value="AT">Austria</option>
|
||||
<option value="AZ">Azerbaidjan</option>
|
||||
|
||||
<option value="BS">Bahamas</option>
|
||||
<option value="BH">Bahrain</option>
|
||||
<option value="BD">Bangladesh</option>
|
||||
<option value="BB">Barbados</option>
|
||||
<option value="BY">Belarus</option>
|
||||
<option value="BE">Belgium</option>
|
||||
|
||||
<option value="BZ">Belize</option>
|
||||
<option value="BJ">Benin</option>
|
||||
<option value="BM">Bermuda</option>
|
||||
<option value="BT">Bhutan</option>
|
||||
<option value="BO">Bolivia</option>
|
||||
<option value="BA">Bosnia-Herzegovina</option>
|
||||
|
||||
<option value="BW">Botswana</option>
|
||||
<option value="BV">Bouvet Island</option>
|
||||
<option value="BR">Brazil</option>
|
||||
<option value="IO">British Indian Ocean Territory</option>
|
||||
<option value="BN">Brunei Darussalam</option>
|
||||
<option value="BG">Bulgaria</option>
|
||||
|
||||
<option value="BF">Burkina Faso</option>
|
||||
<option value="BI">Burundi</option>
|
||||
<option value="KH">Cambodia</option>
|
||||
<option value="CM">Cameroon</option>
|
||||
<option value="CV">Cape Verde</option>
|
||||
<option value="KY">Cayman Islands</option>
|
||||
|
||||
<option value="CF">Central African Republic</option>
|
||||
<option value="TD">Chad</option>
|
||||
<option value="CL">Chile</option>
|
||||
<option value="CN">China</option>
|
||||
<option value="CX">Christmas Island</option>
|
||||
<option value="CC">Cocos (Keeling) Islands</option>
|
||||
|
||||
<option value="CO">Colombia</option>
|
||||
<option value="KM">Comoros</option>
|
||||
<option value="CG">Congo</option>
|
||||
<option value="CK">Cook Islands</option>
|
||||
<option value="CR">Costa Rica</option>
|
||||
<option value="HR">Croatia</option>
|
||||
|
||||
<option value="CU">Cuba</option>
|
||||
<option value="CY">Cyprus</option>
|
||||
<option value="CZ">Czech Republic</option>
|
||||
<option value="DK">Denmark</option>
|
||||
<option value="DJ">Djibouti</option>
|
||||
<option value="DM">Dominica</option>
|
||||
|
||||
<option value="DO">Dominican Republic</option>
|
||||
<option value="TP">East Timor</option>
|
||||
<option value="EC">Ecuador</option>
|
||||
<option value="EG">Egypt</option>
|
||||
<option value="SV">El Salvador</option>
|
||||
<option value="GQ">Equatorial Guinea</option>
|
||||
|
||||
<option value="ER">Eritrea</option>
|
||||
<option value="EE">Estonia</option>
|
||||
<option value="ET">Ethiopia</option>
|
||||
<option value="FK">Falkland Islands</option>
|
||||
<option value="FO">Faroe Islands</option>
|
||||
<option value="FJ">Fiji</option>
|
||||
|
||||
<option value="FI">Finland</option>
|
||||
<option value="CS">Former Czechoslovakia</option>
|
||||
<option value="SU">Former USSR</option>
|
||||
<option value="FR">France</option>
|
||||
<option value="FX">France (European Territory)</option>
|
||||
<option value="GF">French Guyana</option>
|
||||
|
||||
<option value="TF">French Southern Territories</option>
|
||||
<option value="GA">Gabon</option>
|
||||
<option value="GM">Gambia</option>
|
||||
<option value="GE">Georgia</option>
|
||||
<option value="DE">Germany</option>
|
||||
<option value="GH">Ghana</option>
|
||||
|
||||
<option value="GI">Gibraltar</option>
|
||||
<option value="GB">Great Britain</option>
|
||||
<option value="GR">Greece</option>
|
||||
<option value="GL">Greenland</option>
|
||||
<option value="GD">Grenada</option>
|
||||
<option value="GP">Guadeloupe (French)</option>
|
||||
|
||||
<option value="GU">Guam (USA)</option>
|
||||
<option value="GT">Guatemala</option>
|
||||
<option value="GN">Guinea</option>
|
||||
<option value="GW">Guinea Bissau</option>
|
||||
<option value="GY">Guyana</option>
|
||||
<option value="HT">Haiti</option>
|
||||
|
||||
<option value="HM">Heard and McDonald Islands</option>
|
||||
<option value="HN">Honduras</option>
|
||||
<option value="HK">Hong Kong</option>
|
||||
<option value="HU">Hungary</option>
|
||||
<option value="IS">Iceland</option>
|
||||
<option value="IN">India</option>
|
||||
|
||||
<option value="ID">Indonesia</option>
|
||||
<option value="INT">International</option>
|
||||
<option value="IR">Iran</option>
|
||||
<option value="IQ">Iraq</option>
|
||||
<option value="IE">Ireland</option>
|
||||
<option value="IL">Israel</option>
|
||||
|
||||
<option value="IT">Italy</option>
|
||||
<option value="CI">Ivory Coast (Cote D'Ivoire)</option>
|
||||
<option value="JM">Jamaica</option>
|
||||
<option value="JP">Japan</option>
|
||||
<option value="JO">Jordan</option>
|
||||
<option value="KZ">Kazakhstan</option>
|
||||
|
||||
<option value="KE">Kenya</option>
|
||||
<option value="KI">Kiribati</option>
|
||||
<option value="KW">Kuwait</option>
|
||||
<option value="KG">Kyrgyzstan</option>
|
||||
<option value="LA">Laos</option>
|
||||
<option value="LV">Latvia</option>
|
||||
|
||||
<option value="LB">Lebanon</option>
|
||||
<option value="LS">Lesotho</option>
|
||||
<option value="LR">Liberia</option>
|
||||
<option value="LY">Libya</option>
|
||||
<option value="LI">Liechtenstein</option>
|
||||
<option value="LT">Lithuania</option>
|
||||
|
||||
<option value="LU">Luxembourg</option>
|
||||
<option value="MO">Macau</option>
|
||||
<option value="MK">Macedonia</option>
|
||||
<option value="MG">Madagascar</option>
|
||||
<option value="MW">Malawi</option>
|
||||
<option value="MY">Malaysia</option>
|
||||
|
||||
<option value="MV">Maldives</option>
|
||||
<option value="ML">Mali</option>
|
||||
<option value="MT">Malta</option>
|
||||
<option value="MH">Marshall Islands</option>
|
||||
<option value="MQ">Martinique (French)</option>
|
||||
<option value="MR">Mauritania</option>
|
||||
|
||||
<option value="MU">Mauritius</option>
|
||||
<option value="YT">Mayotte</option>
|
||||
<option value="MX">Mexico</option>
|
||||
<option value="FM">Micronesia</option>
|
||||
<option value="MD">Moldavia</option>
|
||||
<option value="MC">Monaco</option>
|
||||
|
||||
<option value="MN">Mongolia</option>
|
||||
<option value="MS">Montserrat</option>
|
||||
<option value="MA">Morocco</option>
|
||||
<option value="MZ">Mozambique</option>
|
||||
<option value="MM">Myanmar</option>
|
||||
<option value="NA">Namibia</option>
|
||||
|
||||
<option value="NR">Nauru</option>
|
||||
<option value="NP">Nepal</option>
|
||||
<option value="NL">Netherlands</option>
|
||||
<option value="AN">Netherlands Antilles</option>
|
||||
<option value="NT">Neutral Zone</option>
|
||||
<option value="NC">New Caledonia (French)</option>
|
||||
|
||||
<option value="NZ">New Zealand</option>
|
||||
<option value="NI">Nicaragua</option>
|
||||
<option value="NE">Niger</option>
|
||||
<option value="NG">Nigeria</option>
|
||||
<option value="NU">Niue</option>
|
||||
<option value="NF">Norfolk Island</option>
|
||||
|
||||
<option value="KP">North Korea</option>
|
||||
<option value="MP">Northern Mariana Islands</option>
|
||||
<option value="NO">Norway</option>
|
||||
<option value="OM">Oman</option>
|
||||
<option value="PK">Pakistan</option>
|
||||
<option value="PW">Palau</option>
|
||||
|
||||
<option value="PA">Panama</option>
|
||||
<option value="PG">Papua New Guinea</option>
|
||||
<option value="PY">Paraguay</option>
|
||||
<option value="PE">Peru</option>
|
||||
<option value="PH">Philippines</option>
|
||||
<option value="PN">Pitcairn Island</option>
|
||||
|
||||
<option value="PL">Poland</option>
|
||||
<option value="PF">Polynesia (French)</option>
|
||||
<option value="PT">Portugal</option>
|
||||
<option value="PR">Puerto Rico</option>
|
||||
<option value="QA">Qatar</option>
|
||||
<option value="RE">Reunion (French)</option>
|
||||
|
||||
<option value="RO">Romania</option>
|
||||
<option value="RU">Russian Federation</option>
|
||||
<option value="RW">Rwanda</option>
|
||||
<option value="GS">S. Georgia & S. Sandwich Isls.</option>
|
||||
<option value="SH">Saint Helena</option>
|
||||
<option value="KN">Saint Kitts & Nevis Anguilla</option>
|
||||
|
||||
<option value="LC">Saint Lucia</option>
|
||||
<option value="PM">Saint Pierre and Miquelon</option>
|
||||
<option value="ST">Saint Tome (Sao Tome) and Principe</option>
|
||||
<option value="VC">Saint Vincent & Grenadines</option>
|
||||
<option value="WS">Samoa</option>
|
||||
<option value="SM">San Marino</option>
|
||||
|
||||
<option value="SA">Saudi Arabia</option>
|
||||
<option value="SN">Senegal</option>
|
||||
<option value="SC">Seychelles</option>
|
||||
<option value="SL">Sierra Leone</option>
|
||||
<option value="SG">Singapore</option>
|
||||
<option value="SK">Slovak Republic</option>
|
||||
|
||||
<option value="SI">Slovenia</option>
|
||||
<option value="SB">Solomon Islands</option>
|
||||
<option value="SO">Somalia</option>
|
||||
<option value="ZA">South Africa</option>
|
||||
<option value="KR">South Korea</option>
|
||||
<option value="ES">Spain</option>
|
||||
|
||||
<option value="LK">Sri Lanka</option>
|
||||
<option value="SD">Sudan</option>
|
||||
<option value="SR">Suriname</option>
|
||||
<option value="SJ">Svalbard and Jan Mayen Islands</option>
|
||||
<option value="SZ">Swaziland</option>
|
||||
<option value="SE">Sweden</option>
|
||||
|
||||
<option value="CH">Switzerland</option>
|
||||
<option value="SY">Syria</option>
|
||||
<option value="TJ">Tadjikistan</option>
|
||||
<option value="TW">Taiwan</option>
|
||||
<option value="TZ">Tanzania</option>
|
||||
<option value="TH">Thailand</option>
|
||||
|
||||
<option value="TG">Togo</option>
|
||||
<option value="TK">Tokelau</option>
|
||||
<option value="TO">Tonga</option>
|
||||
<option value="TT">Trinidad and Tobago</option>
|
||||
<option value="TN">Tunisia</option>
|
||||
<option value="TR">Turkey</option>
|
||||
|
||||
<option value="TM">Turkmenistan</option>
|
||||
<option value="TC">Turks and Caicos Islands</option>
|
||||
<option value="TV">Tuvalu</option>
|
||||
<option value="UG">Uganda</option>
|
||||
<option value="UA">Ukraine</option>
|
||||
<option value="AE">United Arab Emirates</option>
|
||||
|
||||
<option value="GB">United Kingdom</option>
|
||||
<option value="UY">Uruguay</option>
|
||||
<option value="MIL">USA Military</option>
|
||||
<option value="UM">USA Minor Outlying Islands</option>
|
||||
<option value="UZ">Uzbekistan</option>
|
||||
<option value="VU">Vanuatu</option>
|
||||
|
||||
<option value="VA">Vatican City State</option>
|
||||
<option value="VE">Venezuela</option>
|
||||
<option value="VN">Vietnam</option>
|
||||
<option value="VG">Virgin Islands (British)</option>
|
||||
<option value="VI">Virgin Islands (USA)</option>
|
||||
<option value="WF">Wallis and Futuna Islands</option>
|
||||
|
||||
<option value="EH">Western Sahara</option>
|
||||
<option value="YE">Yemen</option>
|
||||
<option value="YU">Yugoslavia</option>
|
||||
<option value="ZR">Zaire</option>
|
||||
<option value="ZM">Zambia</option>
|
||||
<option value="ZW">Zimbabwe</option>
|
||||
|
||||
</select>
|
||||
<br />
|
||||
|
||||
<select id="State" name="State">
|
||||
|
||||
<option value="" class="selectone">Select One</option>
|
||||
<option value="AB" class="province">Alberta</option>
|
||||
<option value="BC" class="province">British Columbia</option>
|
||||
<option value="MB" class="province">Manitoba</option>
|
||||
|
||||
<option value="NB" class="province">New Brunswick</option>
|
||||
<option value="NF" class="province">Newfoundland</option>
|
||||
<option value="NT" class="province">Northwest Territories</option>
|
||||
<option value="NS" class="province">Nova Scotia</option>
|
||||
<option value="NU" class="province">Nunavut</option>
|
||||
<option value="ON" class="province">Ontario</option>
|
||||
|
||||
<option value="PE" class="province">Prince Edward Island</option>
|
||||
<option value="QC" class="province">Quebec</option>
|
||||
<option value="SK" class="province">Saskatchewan</option>
|
||||
<option value="YT" class="province">Yukon Territory</option>
|
||||
|
||||
<option value="AK" class="state">Alaska</option>
|
||||
<option value="AL" class="state">Alabama</option>
|
||||
|
||||
<option value="AR" class="state">Arkansas</option>
|
||||
<option value="AZ" class="state">Arizona</option>
|
||||
<option value="CA" class="state">California</option>
|
||||
<option value="CO" class="state">Colorado</option>
|
||||
<option value="CT" class="state">Connecticut</option>
|
||||
<option value="DC" class="state">District of Columbia</option>
|
||||
|
||||
<option value="DE" class="state">Delaware</option>
|
||||
<option value="FL" class="state">Florida</option>
|
||||
<option value="GA" class="state">Georgia</option>
|
||||
<option value="HI" class="state">Hawaii</option>
|
||||
<option value="IA" class="state">Iowa</option>
|
||||
<option value="ID" class="state">Idaho</option>
|
||||
|
||||
<option value="IL" class="state">Illinois</option>
|
||||
<option value="IN" class="state">Indiana</option>
|
||||
<option value="KS" class="state">Kansas</option>
|
||||
<option value="KY" class="state">Kentucky</option>
|
||||
<option value="LA" class="state">Louisiana</option>
|
||||
<option value="MA" class="state">Massachusetts</option>
|
||||
|
||||
<option value="MD" class="state">Maryland</option>
|
||||
<option value="ME" class="state">Maine</option>
|
||||
<option value="MI" class="state">Michigan</option>
|
||||
<option value="MN" class="state">Minnesota</option>
|
||||
<option value="MO" class="state">Missouri</option>
|
||||
<option value="MS" class="state">Mississippi</option>
|
||||
|
||||
<option value="MT" class="state">Montana</option>
|
||||
<option value="NC" class="state">North Carolina</option>
|
||||
<option value="ND" class="state">North Dakota</option>
|
||||
<option value="NE" class="state">Nebraska</option>
|
||||
<option value="NH" class="state">New Hampshire</option>
|
||||
<option value="NJ" class="state">New Jersey</option>
|
||||
|
||||
<option value="NM" class="state">New Mexico</option>
|
||||
<option value="NV" class="state">Nevada</option>
|
||||
<option value="NY" class="state">New York</option>
|
||||
<option value="OH" class="state">Ohio</option>
|
||||
<option value="OK" class="state">Oklahoma</option>
|
||||
<option value="OR" class="state">Oregon</option>
|
||||
|
||||
<option value="PA" class="state">Pennsylvania</option>
|
||||
<option value="PR" class="state">Puerto Rico</option>
|
||||
<option value="RI" class="state">Rhode Island</option>
|
||||
<option value="SC" class="state">South Carolina</option>
|
||||
<option value="SD" class="state">South Dakota</option>
|
||||
<option value="TN" class="state">Tennessee</option>
|
||||
|
||||
<option value="TX" class="state">Texas</option>
|
||||
<option value="UT" class="state">Utah</option>
|
||||
<option value="VA" class="state">Virginia</option>
|
||||
<option value="VT" class="state">Vermont</option>
|
||||
<option value="WA" class="state">Washington</option>
|
||||
<option value="WI" class="state">Wisconsin</option>
|
||||
|
||||
<option value="WV" class="state">West Virginia</option>
|
||||
<option value="WY" class="state">Wyoming</option>
|
||||
</select>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,78 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
|
||||
<title>Test for jQuery validate() plugin</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="../demo/css/screen.css" />
|
||||
<link rel="stylesheet" href="../../../themes/flora/flora.all.css" type="text/css" media="screen" title="Flora (Default)">
|
||||
|
||||
<script src="../lib/jquery.js" type="text/javascript"></script>
|
||||
<script src="../../../ui/current/ui.tabs.js" type="text/javascript"></script>
|
||||
<script type="text/javascript" src="../lib/jquery.metadata.js"></script>
|
||||
<script type="text/javascript" src="../jquery.validate.js"></script>
|
||||
<script src="firebug/firebug.js" type="text/javascript"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
$().ready(function() {
|
||||
$("#commentForm").validate({debug:true});
|
||||
$("#example > ul").tabs();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
form.cmxform { width: 470px; }
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<form class="cmxform" id="commentForm" method="get" action="">
|
||||
|
||||
<div id="example" class="flora">
|
||||
<ul>
|
||||
|
||||
<li><a href="#fragment-1"><span>One</span></a></li>
|
||||
<li><a href="#fragment-2"><span>Two</span></a></li>
|
||||
<li><a href="#fragment-3"><span>Three</span></a></li>
|
||||
</ul>
|
||||
<div id="fragment-1">
|
||||
<fieldset>
|
||||
<legend>A simple comment form with submit validation and default messages</legend>
|
||||
<p>
|
||||
<label for="cname">Name (required, at least 2 characters)</label>
|
||||
<input id="cname" name="name" class="some other styles {required:true,minLength:2}" />
|
||||
<p>
|
||||
<label for="cemail">E-Mail (required)</label>
|
||||
<input id="cemail" name="email" class="{required:true,email:true}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="curl">URL (optional)</label>
|
||||
<input id="curl" name="url" class="{url:true}" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="ccomment">Your comment (required)</label>
|
||||
<textarea id="ccomment" name="comment" class="{required:true}"></textarea>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
<div id="fragment-2">
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
</div>
|
||||
<div id="fragment-3">
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<input class="submit" type="submit" value="Submit"/>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user