kazupon / vue-validator

:white_check_mark: Validator component for Vue.js
MIT License
2.19k stars 431 forks source link

FR Pause/restart validation #294

Open curtisblackwell opened 8 years ago

curtisblackwell commented 8 years ago

I have a form I'm submitting async with vue-resource. After submission, I want to reset the form so that it can be resubmitted.

I'm resetting the values by looping through the v-models and setting them to empty strings.

_.forIn(this.form.fields, (data) => {
  data.value = '';
});

I want to do this without displaying all the validation errors that come with the blank fields. Using this.$resetValidation() before/after doing doesn't seem to help out with that, unless I throw it in window.setTimeout, but there's still a flash of errors that way.

If I could pause validation, make my changes, then start up again, that would be super helpful:

this.$pauseValidation();

_.forIn(this.form.fields, (data) => {
  data.value = '';
});

this.$restartValidation();