ASP.net MVC 3 jQuery Validation; Disable Unobtrusive OnKeyUp?

Ok guys,

I was in the same problem and found this thread: http://old.nabble.com/-validate–onkeyup-for-single-field-td21729097s27240.html

The idea is basically to overwrite the keyup event and return false. So in your specific case you’ll need to add:

$('#my-form').validate({
   rules: {
     [...]
   }
} 
// Disable keyup validation for credit card field
$("[data-val-creditcard]").keyup(function() { return false } );

And you’ll see that your credit card field is only checked on blur or submit (but the rest is working on keyup also).

I was looking for the same solution, and found that the answer here could be improved, so I thought it would be nice to share it here.

Leave a Comment