How do I clear MVC client side validation errors when a cancel button is clicked when a user has inv

Posted by Sci-fi on Stack Overflow See other posts from Stack Overflow or by Sci-fi
Published on 2010-05-09T17:03:23Z Indexed on 2010/05/09 17:08 UTC
Read the original article Hit count: 160

I have a partial view that is rendered within a main view. The partial view takes advantage of System.ComponentModel.DataAnnotations and Html.EnableClientValidation().

A link is clicked, and div containing the partial view is displayed within a JQuery.Dialog().

I then click the save button without entering any text in my validated input field. This causes the client side validation to fire as expected, and display the '*required' message beside the invalid field.

When the cancel button is clicked, I want to reset the client side MVC validation back to it's default state and remove any messages, ready for when the user opens the dialog again. Is there a recommended way of doing this?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about form-validation