Vue 3 Form Validation Not Triggering on Dynamic Input Removal - Seeking Advice
I'm attempting to set up I'm sure I'm missing something obvious here, but I'm working on a Vue 3 application where I've implemented a form with dynamic fields using `v-for` to render them. However, I'm running into an scenario where the validation doesn’t seem to trigger when I remove a field dynamically. I’m using VeeValidate for form validation, and I’ve set up rules for each field. When I remove a field, I expect the validation to reflect that change, but the validation state remains unchanged. Here’s a snippet of my code: ```vue <template> <form @submit.prevent="handleSubmit"> <div v-for="(item, index) in items" :key="index"> <input v-model="item.name" v-validate="'required'" name="name" /> <span v-if="errors.has(`name_${index}`)">{{ errors.first(`name_${index}`) }}</span> <button @click="removeField(index)">Remove</button> </div> <button type="submit">Submit</button> </form> </template> <script> import { defineComponent, ref } from 'vue'; import { useForm } from 'vee-validate'; export default defineComponent({ setup() { const { errors, validate, handleSubmit } = useForm(); const items = ref([{ name: '' }]); const removeField = (index) => { items.value.splice(index, 1); // Attempting to manually clear validation errors.remove(`name_${index}`); }; return { items, errors, handleSubmit, removeField }; }, }); </script> ``` I’ve tried calling `errors.remove` after removing the field, but it doesn’t seem to update the validation state correctly. Additionally, I’ve confirmed that my validation schema is set up properly. I even attempted to manually trigger validation again after modifying the fields, but that didn't yield any results either. Has anyone experienced similar issues, or can you suggest a method to ensure that validation updates correctly when fields are dynamically removed? My development environment is Ubuntu. Thanks in advance! My development environment is Windows. Any help would be greatly appreciated! Any help would be greatly appreciated!