Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET MVC Manually remove unobtrusive validation error

With regard to the post here, how does one remove these errors once they've been shown and resolved?

I've added an error via:

var errorArray = {};
errorArray["Slug"] = 'Some error message for the Slug text box';
$('#SomeFormId').validate().showErrors(errorArray);

But I can't get the errors to clear after an ajax post of the form.

like image 967
Travis Heseman Avatar asked Jan 16 '14 17:01

Travis Heseman


1 Answers

var validator = form.validate();
$('#SomeFormId').find('.field-validation-error span').each(function () {
    validator.settings.success($(this));
});
validator.resetForm();
like image 108
Travis Heseman Avatar answered Oct 14 '22 14:10

Travis Heseman