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 feel like I'm going crazy at this point, I've spent around 11 hours trying to get this to work.
My first attempts were using an array of useField, but as soon as I pushed a new element to the array it gets validated, which in terms of user experience is you open a modal and most fields are red as if you had already touched everything.
Doing some digging I saw that the recommended way to work with arrays of fields is using useFieldArray. It worked great in terms of handling different fields and having each of them having an independent validation, and also adding new elements to the array doesn't immediately trigger their validation. What I'm falling short on is that trying to use an input for the user to upload files doesn't seem to work.
In the following snippet I did my best to get it to work, but I haven't found a way to make the file field be validated.
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 feel like I'm going crazy at this point, I've spent around 11 hours trying to get this to work.
My first attempts were using an array of useField, but as soon as I pushed a new element to the array it gets validated, which in terms of user experience is you open a modal and most fields are red as if you had already touched everything.
Doing some digging I saw that the recommended way to work with arrays of fields is using useFieldArray. It worked great in terms of handling different fields and having each of them having an independent validation, and also adding new elements to the array doesn't immediately trigger their validation. What I'm falling short on is that trying to use an input for the user to upload files doesn't seem to work.
In the following snippet I did my best to get it to work, but I haven't found a way to make the file field be validated.
https://stackblitz.com/edit/vue3-script-setup-with-vite-hskgv1?file=src%2Fcomponents%2FInventoryFormInputs.vue
Any inputs or suggestions will be greatly appreciated.
Beta Was this translation helpful? Give feedback.
All reactions