How to apply different validation to each element of an array? #7806
Unanswered
julio3266
asked this question in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a form and I need to validate only one index within the field, example: If I have fiscalCode[0], fiscalCode[1], fiscalCode[2], fiscalCode[3], it will only validate fiscalCode[0]. The problem is when. I'm trying to validate using the "when" of yup, but when I insert a validation, it pulls the values but I have two problems:
The first problem is that when I press the submit button and it will validate the form, it does not pull the value at the time the function triggers, it only takes the values after refreshing the app, or changing something in the code.
The second problem is that it does not bring the fiscalCode field at all, I will insert prints of the code and consoles.log
My validation schema:

my parent component:

my input:

output (console.log) for validation schema:

output for object validation errors:

Beta Was this translation helpful? Give feedback.
All reactions