Vee-validate: Unable to clear error after reseting value

Created on 3 Mar 2017  ·  11Comments  ·  Source: logaretm/vee-validate

Versions:

  • VueJs: 2.2.1
  • Vee-Validate: 2.0.0-beta.23

Description:

i want to reset both value and validation.
i look up for some information, for example https://github.com/logaretm/vee-validate/issues/230
and i try to use errors.clear after setting the value to init one.
However it failed.
i try nextTick and requestAnimationFrame, it do not work.Only when i use setTimeout for more that 4 ms, it work.
so are there any reliable way to clear value and validation?

to reproduce.
you can enter the reset button.

Steps To Reproduce:

here is the the reproduce link
https://codepen.io/toxic-johann/pen/wJGxEj

✨ enhancement 🐛 bug

Most helpful comment

@toxic-johann It is released:

https://codepen.io/logaretm/pen/BWLQra

All 11 comments

I will try to improve the update cycle of the plugin, there seem to be an issue with the update cycle handling.

when will you publish this?

probably tomorrow if I didn't manage to squeeze more fixes.

@toxic-johann It is released:

https://codepen.io/logaretm/pen/BWLQra

thanks~

There seems to be an issue when using a validation delay : https://codepen.io/anon/pen/VpQPdZ

  • The first input has no delay : OK
  • The second input has a 500ms delay : reseting only errors works, but reseting value and error ends with another error on that field

@Finrod927 I guess that is expected, since the value change occurs 500 after the errors have been reset, not sure if I can do anything about that.

Thanks for the quick answer, I must admit it makes senses.

Is it possible to modifiy the delay with an API?
I need to reset my form after submitting it. So I would reset it to 0 when submitting the form, and set it back to 500ms after the form is correctly submitted.

validateAll doesn't respect the delay, so you might use it to validate all fields immediately, changing the delays dynamically can be challenging atm, since I have to re-attach all listeners with the new delay value, definitely doable tho.

Ok thanks, I will check that

Was this page helpful?
0 / 5 - 0 ratings