Nate
Nate

Reputation: 2084

asp.net mvc3 clientside validation disable for button

I need to save data when a SAVE button is clicked but it needs to ignore validation on the client side and simply post all results. When the FINISH button is clicked, it needs to run through the complete validation for all the controls. How do you selectively disable clientside validation for asp.net mvc3?

Upvotes: 0

Views: 2351

Answers (2)

Nate
Nate

Reputation: 2084


(input id="MyElement" type="submit" value="Save"/)
(script type="text/javascript")
document.getElementById("MyElement").disableValidation=true;

or
>script type="text/javascript">
$("#MyElement").disableValidation=true;
(/script)

Upvotes: 0

Adam Tuliper
Adam Tuliper

Reputation: 30162

See my other post here assuming jquery validation ASP.NET MVC 3 jQuery client validation - disable for specific button (Ajax form)

If you aren't using jquery validation for MVC but MS MVC validation then I think the CSS class just needs to be 'cancel'

Upvotes: 1

Related Questions