Change validation settings for specific form
asp.net-mvc, asp.net-mvc-4, jquery-validate, unobtrusive-validation
Solution
I found the solution:
$.validator.unobtrusive.parse($form); // parse the form
var validator = $.data($form[0], 'validator'); // get the form's validator
validator.settings.ignore = ''; // change its settings
Problem
Consider the `form` that are loaded via AJAX. After appending the `form` to the document I'm calling ``` $.validator.unobtrusive.parse($form); ``` and the client validation works like a charm. However there are some scenarios, when I need to change the validation settings, like `ignore`, so I call ``` $form.validate({ ignore: '' }); $.validator.unobtrusive.parse($form); // and parse with new settings ``` In this case unobtrusive client validation just doesn't work. What could be the issue? Edit "Doesn't work" means, `$form.valid()` is always `true`.