Manually modify the error state of the field
I want to initiate a request after passing a form validation. I can only know which form fields are illegal after the request is returned. Is it possible to modify the field status?

5 Replies
inland-turquoise•13mo ago
You need to modify the
errorMap
, not errors
fair-roseOP•13mo ago
@crutchcorn Can you give me a code example? I feel a little stuck.😠ðŸ˜
inland-turquoise•13mo ago
S'all good 🙂 I'm not avail to give a full code sample at the moment (CC @Leonardo might be able to help) but will get back to you later today if nothing else
fair-roseOP•13mo ago
Many thanks🥹
ratty-blush•13mo ago
This seems like a good use case to extend our
FieldValidateFn
to also take an async function, then you could use await mutateAsync
inside a validator and return strings so that the form will handle where to put them (inside errorMap
) 🤔
Anyway @awn with this snippet you can set errors manually and you will find them already into the errors
array of a form or a field