I have a form in dotvvm 2.0 application. When I do a postback and it validates a viewmodel with errors it sets a css class of associated control to "invalid" (Validator.InvalidCssClass="is-invalid"). Is it possible to clear those validation errors and set the css class to default?
Asked
Active
Viewed 190 times
1 Answers
0
If you want to clear validation error from the entire view model in Javascript, you can invoke dotvvm.validation.clearValidationErrors(dotvvm.viewModelObservables.root)
. To clear error only from a part of the view model, you replace the dotvvm.viewModelObservables.root
with an expression that returns an ko.observable with your view model inside. For example dotvvm.validation.clearValidationErrors(ko.contextFor(myElement).$rawData)
will clear error in the data context of the myElement
DOM element.

exyi
- 452
- 3
- 12