Hello i want to validate dynamic fields using vee validate, Fields having the same name. For Example
This looks like a clean approach to dynamically generating fields with Vee Validate. However, handling validation for fields with the same name might get tricky since Vee Validate uses name as the unique identifier for validation. You could try appending an index or key to the field names dynamically to ensure they are unique, like field.name + '_' + key. This should help Vee Validate distinguish between different instances of the same field type and display the correct error messages.
Also, as someone who loves generating creative content, this reminds me of a tool I recently used, the God Name Generator. It dynamically creates unique names with different themes, and it struck me how it’s similar to the way you’re dynamically handling these form fields. Maybe consider something like that for inspiration on structuring dynamic content cleanly.
I have attached (step 2) and the (horizontal) vue page, is there way to validate all the dynamic fields inside the step2, I feel like Yup Object is ignoring dynamic fields
Hi Syed,
I think "Form Generator" page describes how you can validate dynamically rendered fields. See
Regards,
Lauris Stepanovs,
Keenthemes Support Team
Sign Up
Already have an account?Sign in here ref="horizontalWizardRef"Profile Information
Shipping Information
Banking Information
Documents & Legal
Login Information
Hi Syed,
The name attribute value should be unique for each field.
You can use your key variable to make name value unique and then use the name for validation.
:name="`${field.name}-${key}`"
Regards, Lauris Stepanovs, Keenthemes Support Team