# \[Validation series\] hide validator in page when field becomes valid again

**URL:** <https://forum.dotvvm.com/t/validation-series-hide-validator-in-page-when-field-becomes-valid-again/147>\
**Category:** Discussion in English\
**Created:** [February 18, 2024, 9:08pm UTC](https://forum.dotvvm.com/t/validation-series-hide-validator-in-page-when-field-becomes-valid-again/147 "2024-02-18T21:08:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarianV](https://forum.dotvvm.com/letter_avatar_proxy/v4/letter/m/c0e974/32.png) [@MarianV](https://forum.dotvvm.com/u/MarianV)\
**Post date:** [February 18, 2024, 9:08pm UTC](https://forum.dotvvm.com/t/validation-series-hide-validator-in-page-when-field-becomes-valid-again/147/1 "2024-02-18T21:08:37Z")

</div>

If I hit the validation trigger button, several validators are displayed for the invalid fields (let’s say empty textboxes and unselected dropdowns, all with `[Required]` on their bound properties). If the user makes any of these fields no longer empty/unselected, I would like the corresponding validators to hide automatically (without hitting the button again).

Is there an easy existing way to centrally achieve this for all validators on page, or must I write custom event handlers and bind them explicitly to all the fields?

Any idea?

PS: I’m aware of this: [https://stackoverflow.com/questions/52506187/dotvvm-validation-errors-clear](https://stackoverflow.com/questions/52506187/dotvvm-validation-errors-clear)

---

<div class="post-metadata">

**Author:** ![exyi](https://forum.dotvvm.com/user_avatar/forum.dotvvm.com/exyi/32/9_2.png) [@exyi](https://forum.dotvvm.com/u/exyi)\
**Post date:** [February 18, 2024, 9:48pm UTC](https://forum.dotvvm.com/t/validation-series-hide-validator-in-page-when-field-becomes-valid-again/147/2 "2024-02-18T21:48:43Z")

</div>

I’m not aware of any easy way to automatically clear the errors after a change. If you’d be happy applying this globally to all properties, then it shouldn’t be a problem to write a script for it. I could help you with it when I get more time for this, this is the DotVVM API you’d need:

```auto
let oldState = dotvvm.state
dotvvm.events.newState.subscribe(newState => {
    // ... deep comparison of newState/oldState
    // clear changed properties using dotvvm.validation.removeErrors("/Validation/Path")
    oldState = newState
})

```
