Here is the jquery unobtrusive adapter which i am using for client side validation in the mvc application. Right now the validation is working but it is doing on onkeupevent . I am looking to have the clientside validation fireup only after the user leaves the field - Could anyone guide me on how to get this working?. I want to set this configuration only for certain fields not the entire form.
jQuery.validator.unobtrusive.adapters.add("compareemail", ["otherproperty"], function (options) {
options.rules["compareemail"] = options.params.otherproperty;
options.messages["compareemail"] = options.message;
});
jQuery.validator.addMethod("compareemail", function (value, element, params) {
var reasonElement = $('#personalDetailsEmail');
var testval = reasonElement.val();
if (value != testval) {
return false;
}
return true;
});
Thankyou