vee-validate: Validate fails the first time and pass the second time (as all fields are filled ok)

Versions:

  • VueJs: 2.2.1
  • Vee-Validate: 2.0.0-rc.6

Description:

Submitting with method … @click.native="someMethod" I need to click my button twice as the first time the form validation is failing.

Error bag remains empty.

Steps To Reproduce:

in someMethod …

this.$validator.validateAll().then((result) => {
        if (!result) {
          console.log('Cannot validate form', result);
          return;
        }

If I forget to fill fields that is working as expected. But if all fields are filed and no errors, I click, get Cannot validate form, click the button again and it pass the validation.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I see, I will debug this locally and get back to you.

I ended up here with the same issue as the OP.

My issue was caused by me mistakenly adding the v-model variable a watcher instead of to data().

The watcher part is irrelevant but not being in data mean’t that the first click created the variable so would always return false but once it had been added it triggered validation correctly requiring 2 clicks.