Question about Initial Validation Behavior with useFieldArray in VeeValidate

176 Views Asked by At

I am using VeeValidate for form validation in my Vue.js project and have encountered a behavior that I am seeking clarification on. Specifically, I am using the useFieldArray hook to manage an array of fields in my form. I have observed that upon initial form rendering, validation messages are displayed for the fields within this array, even though I have not interacted with the form yet.

In contrast, when using useField for individual fields, validation messages do not appear until the field is interacted with. This difference in behavior between useField and useFieldArray is not clear to me.

Could you please clarify if this is the expected behavior with useFieldArray? If so, is there a recommended approach to prevent initial validation messages from appearing for fields within an array, similar to how useField works for individual fields?

Thank you for your assistance and any insights you can provide on this matter.

Best regards,

I have successfully implemented form validation using VeeValidate in a Vue.js project, utilizing a component-based approach instead of the Composition API. This method worked well, however, I would prefer to use the Composition API if possible.

My main challenge with the Composition API is ensuring that validation messages do not appear initially, similar to how it behaves with the component-based approach.

Is there a way to achieve this using the Composition API with VeeValidate, where validation messages are not displayed on initial render but only after user interaction?

0

There are 0 best solutions below