You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i have a form using react hook form, in this form contains the following structure: Rooms -> Guests -> forms for each guest, using useFieldArray for generating two arrays, one for rooms and other for guests.
estructure of Array:
Code of Parent Component (Rooms):
Code of Child Component(Form for each guest):
The problem is that as I have an array structure and the form is rendered in the second useFieldArray, it would be necessary to insert the validation to be controlled from the second component(Child), if I set the resolvers using the useForm of the first component(rooms) , it will set the same validation for all inputs regardless of array
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
i have a form using react hook form, in this form contains the following structure: Rooms -> Guests -> forms for each guest, using useFieldArray for generating two arrays, one for rooms and other for guests.
estructure of Array:
![Captura de Tela 2022-02-09 às 13 58 02](https://user-images.githubusercontent.com/52897217/153250715-69f3a69c-e1d7-43ec-aa84-8086d39d1339.png)
Code of Parent Component (Rooms):
![Captura de Tela 2022-02-09 às 13 58 44](https://user-images.githubusercontent.com/52897217/153250933-09a05638-88ca-4655-9b7e-f4f1e6938e7d.png)
Code of Child Component(Form for each guest):
![code](https://user-images.githubusercontent.com/52897217/153251335-24773252-60ea-40f9-bc0e-1089d3759a78.png)
The problem is that as I have an array structure and the form is rendered in the second useFieldArray, it would be necessary to insert the validation to be controlled from the second component(Child), if I set the resolvers using the useForm of the first component(rooms) , it will set the same validation for all inputs regardless of array
Beta Was this translation helpful? Give feedback.
All reactions