Programatically disabling jQuery client validation in ASP.NET MVC
I am using the jQuery MVC validation library for ASP.NET MVC, which is working fine.
However, on my form I have a 'Cancel' and a 'Save' button, both of which I want to submit the form back to the server.
However, if the user clicks 'Cancel' I need to disable the client side validation s开发者_开发技巧o that the user doesn't get prompted to complete required fields before they can cancel!
Any pointers would be appreciated!
Thanks.
I found a solution if you still have the same problem : step by step problem with validation on "back" button
Hope this helps!
So, when the user clicks cancel, what exactly you are expecting to happen? If you want to just redirect to a different page, then make sure the "cancel" button type is not submit and onclick of the cancel button, redirect to a different page. Button click will not validate the fields if it is not of submit type.
精彩评论