Closed
Description
I was working on a form where I couldn't change the name of the field, so I changed manually the security.dev.js file to fit my needs.
I think I could be easy and convienient to be able to target custom rule to make password/password confirmation manageable via plugin options.
In my case, I used data-attr to match :
$.formUtils.addValidator({
name : 'confirmation',
validatorFunction : function(value, $el, config, language, $form) {
var conf = '',
confInputName = $el.attr('data-name') + '_confirmation',
confInput = $form.find('input[data-name="' +confInputName+ '"]').eq(0);
if (confInput) {
conf = confInput.val();
} else {
console.warn('Could not find an input with name "'+confInputName+'"');
}
return value === conf;
},
errorMessage : '',
errorMessageKey: 'notConfirmed'
});