Reset Form v4.x with ionic inputs #3099
-
Hello, First of all, I would like to say thank you, great library! I am using the v4.x (with Vue 3 and Ionic) and I am trying to reset the form using FormActions.resetForm() after submit. The values reset but the errors trigger as well. I do not want the errors to trigger. I tried all the following methods from FormActions: export interface FormActions { and the form state: interface FormState { But not luck. How can I achieve this? Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
Create a minimal example on codesandbox and I will happily take a look. |
Beta Was this translation helpful? Give feedback.
-
Hello! Thanks for your quick reply. I just created a quick codesandbox: https://codesandbox.io/s/infallible-lovelace-5mf4n?file=/src/main.js But the issue seems to come from the Ionic components. When I use regular HTML I have no issues, but when I use the Ionic component, it ignores, for example, the validateOnInput: false and trigger the errors after a reset. I'll have a closer look at the Ionic input component. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I'm not familiar with ionic, but feel free to create a repo with ionic, and I will take a look. |
Beta Was this translation helpful? Give feedback.
-
Hi again, Sorry I just had the time to do it: https://codesandbox.io/s/hopeful-galois-bj88m After the resetForm() it triggers the errors. I am using global rules. Home.vue Thanks for your help! |
Beta Was this translation helpful? Give feedback.
-
@amiraiouaz After investigation, it looks like Ionic input components emit an it might be worth it for you to report this behavior to the ionic team, specifically emitting an This is not a vee-validate issue and no reliable changes can be introduced to fix it. As a workaround disabling the Workaround demo: https://codesandbox.io/s/purple-rgb-gvnc8?file=/src/views/Home.vue |
Beta Was this translation helpful? Give feedback.
@amiraiouaz After investigation, it looks like Ionic input components emit an
update:modelValue
event when the value is changed via props which doesn't make sense.it might be worth it for you to report this behavior to the ionic team, specifically emitting an
update:modelValue
when themodelValue
prop is changed externally because there is nothing to sync.This is not a vee-validate issue and no reliable changes can be introduced to fix it. As a workaround disabling the
validateOnModelUpdate
should do the trick.Workaround demo: https://codesandbox.io/s/purple-rgb-gvnc8?file=/src/views/Home.vue