ASP.NET MVC Manually remove unobtrusive validation error
Asked Answered
B

1

5

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.

Buchheim answered 16/1, 2014 at 17:27 Comment(0)
B
7
var validator = form.validate();
$('#SomeFormId').find('.field-validation-error span').each(function () {
    validator.settings.success($(this));
});
validator.resetForm();
Buchheim answered 16/1, 2014 at 20:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.