#Is there a way to get Mantine form to validate onBlur and re-validate onChange?

9 messages · Page 1 of 1 (latest)

south mountain
#

React hook form has the feature where you can validate on blur. And once it's been validated, is dirty, touched... then it will switch to validating on change.

It makes for a really nice UX.

Any chance this can be a feature request if this is currently unsupported?

vale wave
south mountain
#

I don't want it to validate onChange right away. I want it to first validate on blur, and then "re-validate" onChange. This way the user is not presented with an error right away. But after blur, validations switch to onChange.

It's a very helpful feature.

Am I describing it well enough to understand?

sinful grail
#

you can extend form.getInputProps to handle this

#

i've misread what you want and just done an example onBlur - either way you can extend this function so that after first blur it sets a state, then validate during onChange

south mountain
#

Yes, I see it now. Thank you.

As for tracking a previous onBlur, would I need to manage my own state for that, or does the form track this?

sinful grail
#

if they do not help then just track your own separate state