Validation fires on Form Submit and if you want to reset the validation message before form submit then you can clear it manually by submitting the form or resetting the class attribute. Example
here.
The summary shouldn't disappear unless you are using some type of client-side validator for your forms
(as they are typically checked server-side within a POST). If you would like it to disappear, you would need to implement some client-side validation to check your fields for valid data.
This actually isn't much of a hack at all. I've seen plenty of examples of code that use the same type of validation. It's always important to validate input both server-side and client-side. (Client-side can make the user experience much easier as well.)
CareerChange
Member
43 Points
180 Posts
Html.ValidationSummary errors still remain when errors fixed
Jan 10, 2013 12:02 PM|LINK
Hi
Can anyone please tell me whether the Html.ValidationSummary errors are supposed to disappear when errors have corrected(client side)
At the moment, I'm unable to find a way to remove the error message, even when error is corrected.
Thanks
George
CPrakash82
All-Star
18284 Points
2841 Posts
Re: Html.ValidationSummary errors still remain when errors fixed
Jan 10, 2013 12:09 PM|LINK
Validation fires on Form Submit and if you want to reset the validation message before form submit then you can clear it manually by submitting the form or resetting the class attribute. Example here.
Rion William...
All-Star
27612 Points
4567 Posts
Re: Html.ValidationSummary errors still remain when errors fixed
Jan 10, 2013 12:10 PM|LINK
The summary shouldn't disappear unless you are using some type of client-side validator for your forms (as they are typically checked server-side within a POST). If you would like it to disappear, you would need to implement some client-side validation to check your fields for valid data.
CareerChange
Member
43 Points
180 Posts
Re: Html.ValidationSummary errors still remain when errors fixed
Jan 10, 2013 02:19 PM|LINK
Hi
Fixed it with a bit of a hack.
$(function () { $('#frm').submit(function (e) { if ($(this).valid()) { $('.validation-summary-errors').remove(); } }); });Rion William...
All-Star
27612 Points
4567 Posts
Re: Html.ValidationSummary errors still remain when errors fixed
Jan 10, 2013 03:53 PM|LINK
This actually isn't much of a hack at all. I've seen plenty of examples of code that use the same type of validation. It's always important to validate input both server-side and client-side. (Client-side can make the user experience much easier as well.)