Form validation not triggering for dynamically added inputs in Vue 3
I've encountered a strange issue with I've searched everywhere and can't find a clear answer... I'm working on a project and hit a roadblock... I'm working on a Vue 3 application where I have a form that allows users to dynamically add multiple fields for entering skills. I'm using the VeeValidate library for form validation. However, I'm working with a question where the validation does not trigger for the dynamically added inputs. Hereβs a simplified version of my setup: ```javascript <template> <form @submit.prevent="submitForm"> <div v-for="(skill, index) in skills" :key="index"> <input type="text" v-model="skill.name" v-validate="'required'" :name="`skills.${index}.name`" /> <span v-if="errors.has(`skills.${index}.name`)">{{ errors.first(`skills.${index}.name`) }}</span> </div> <button type="button" @click="addSkill">Add Skill</button> <button type="submit">Submit</button> </form> </template> <script> import { required } from '@vee-validate/rules'; import { defineRule, useForm } from 'vee-validate'; defineRule('required', required); export default { data() { return { skills: [{ name: '' }] }; }, methods: { addSkill() { this.skills.push({ name: '' }); }, submitForm() { this.$refs.form.validate(); // Logic to handle form submission } } }; </script> ``` When I add a new skill and try to submit the form, the validation does not seem to apply to the new inputs. I can see the behavior message for the original inputs, but nothing for the dynamically created ones. Iβve tried calling `this.$refs.form.validate()` on form submission, but it doesn't seem to catch the new fields. The VeeValidate version is 4.5.0. I also checked to ensure that each input has a unique name attribute. Any suggestions on how to make validation work for these dynamically added fields? For context: I'm using Javascript on Ubuntu. I'd really appreciate any guidance on this. My development environment is Windows 10. Am I missing something obvious? I'm working in a Windows 11 environment. I'm open to any suggestions.