Disable MVC Validation based on another fields using Jquery
You can use following to remove all validation rules from an element
$('#Password').rules('remove')
To remove specific rule use
$('#Password').rules('remove', 'required')
And to add validation rule
$("#Password").rules("add", "required");
OR
$("#Password").rules("add", { minlength: 2 });
Also you need to remove validation in Controller's POST action.
ModelState.Remove(field)
No comments:
Post a Comment