How to show the error message for an empty array on the first input field that uses #3621
Unanswered
florianwalther-private
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a bunch of input fields in my form, like this:
Internally, they use Formik's
useField
hook to handle the error state:The validation schema requires the array to have one element, meaning that only one select field has to contain a value:
Question: How can I let the first input field show the error message when the array is empty? Since I pass
languages[0]
and notlanguage
as the name to the first input field,useField
is not connected to thevalidationSchema
.If my approach is wrong, what's the correct way to show the error message here?
Also, my current setup creates this weird bug where each input field shows one letter of the error message after it was touched:
Beta Was this translation helpful? Give feedback.
All reactions