Clear error on Knockout-Validation

Clarence Klopfstein picture Clarence Klopfstein · Dec 5, 2012 · Viewed 14.1k times · Source

I have a page setup with Knockout.js and using Knockout-Validation.

During the page load I put another plugin on a select box which fires a change, which fires the validation. I need to be able to clear that error using JS so I can start with a fresh looking UI and give feedback on the form post or select box change.

I can't find anything that allows me to clear an error in Knockout-Validation.

Answer

Code Novitiate picture Code Novitiate · Jan 24, 2013

Probably a better way that follows what is already implemented in knockout validation is to say property.isModified(false);

if you have a whole view model to reset simply loop through all the validated properties and call that isModified(false)

See the comment from Eric Barnard here

Hope that helps