Input Field Validation: Field Remains Invalid After Clearing a Valid Phone Number
YourKey opened this issue · 0 comments
YourKey commented
Version: vue-tel-input@6.0.5
When a valid phone number is entered into the input field and then cleared (model becomes an empty string ''), the field remains invalid and displays an error message indicating an incorrect phone format. This prevents the form from being submitted.
Example: https://stackblitz.com/edit/vitejs-vite-7kjtqm?file=src%2FApp.vue
I found this temporary solution to make the form work:
const phoneInput = ref(null);
watch(phone, (value) => {
if (!value) {
phoneInput.value.phoneObject.valid = true;
}
});
<vue-tel-input
v-model="phone"
ref="phoneInput"
></vue-tel-input>