Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failedRules aren't reset after form.reset() #2552

Closed
kkojot opened this issue Dec 17, 2019 · 1 comment
Closed

failedRules aren't reset after form.reset() #2552

kkojot opened this issue Dec 17, 2019 · 1 comment
Labels
🐛 bug Unintended behavior

Comments

@kkojot
Copy link

kkojot commented Dec 17, 2019

Versions

  • vee-validate: 3.2.0
  • vue: 2.6.11

Describe the bug
After form submission, I want to reset all values and hide validation errors. These which depend on failedRules are still showing up.

To reproduce
Steps to reproduce the behavior:

  1. Go to https://codesandbox.io/s/vee-validate-3-reset-checkbox-validation-qr8uw
  2. Select and unselect some meal types. You can see that validation error shows up correctly when no checkbox is selected.
  3. Click on the save button. The form should be reset and the validation error should disappear, but it isn't.

Expected behavior
this.$refs.observer.reset(); should reset failedRules too.

Demo link
https://codesandbox.io/s/vee-validate-3-reset-checkbox-validation-qr8uw

Additional context
A very similar problem is described in the docs. The provided solution seems to be invalid because after submitting the form all of the validation errors show up. To solve this you probably need to change the this.$nextTick(() => {...} to requestAnimationFrame(() => {...}.

PS. The answer to this stackoverflow question seems to work fine...

@logaretm logaretm added the 🐛 bug Unintended behavior label Dec 20, 2019
@logaretm
Copy link
Owner

Thanks for reporting this, I have identified the issue and fixed it. Should be up with 3.2.1 soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants