Hello,
I have a validator set up on my form. I have several fields listed as required with data-required-message attributes to display specific messages.
I also have a custom rule to compare two password fields to make sure they are the same:
$frmCreateUser.kendoValidator({
validateOnBlur:
true
,
rules: {
passwordmismatch:
function
(input) {
if
(input.is(
'[data-passwordmismatch-msg]'
)) {
var
password = $.trim($password.val());
var
password2 = $.trim($password2.val());
return
(password === password2);
}
}
}
});
var
validator = $formContainer.data(
'kendoValidator'
);
$frmCreateUser.submit(
function
(event) {
event.preventDefault();
console.log(
'submit'
);
if
(validator.validate()) {
console.log(
'valid'
);
userViewModel.save();
}
else
{
console.log(
'invalid!'
);
}
});
What is happening is even when all of the required rules pass and the password mismatch rule returns true, the validator still returns false. If I remove the custom rule everything works fine.
Any help would be greatly appreciated.