I use jquery.validate.js to validate the forms on our site. Today I updated the version of the validation plugin to v 1.9 and since then I have a problem with password validations on site.
I found why that is happen and now I looking for "correct" way to solve it. In previous version the method attributeRules was as follows:
attributeRules: function (element) {
var rules = {};
var $element = $(element);
for (var method in $.validator.methods) {
var value = $element.attr(method);
if (value) {
rules[method] = value;
}
}
// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
delete rules.maxlength;
}
return rules;
}
In version 1.9, it looks a little bit differ:
attributeRules: function (element) {
var rules = {};
var $element = $(element);
for (var method in $.validator.methods) {
var value;
// If .prop exists (jQuery >= 1.6), use it to get true/false for required
if (method === 'required' && typeof $.fn.prop === 'function') {
value = $element.prop(method);
} else {
value = $element.attr(method);
}
if (value) {
rules[method] = value;
} else if ($element[0].getAttribute("type") === method) {
rules[method] = true;
}
}
// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs
if (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {
delete rules.maxlength;
}
return rules;
}
I understand from that, that in previous versions, the method didn't check the type attribute of input element and didn't add "password" validator. In ver 1.9 it checks if element has type "password" and adds validator.
The question:
How to tell to jQuery.validator to ignore inputs with "password" type?
Thanks
input[type="password"](cause you want to leavepasswordrule), but not to validate those inputs? Why do you need rulepassword, when you don't want to validate them?