Cannot validate input fields in Vue.js

304 Views Asked by At

I am using vue wizard and trying to use vee-validate to validate the individual step but when i fill up the values it does not validate.

Here is a codesandbox link that i'm trying :

https://codesandbox.io/s/ecstatic-https-oc4u2?file=/src/App.vue

Any help is highly appreciated.

1

There are 1 best solutions below

0
On BEST ANSWER

Follow up to my comment. Sorry, you are right, I did not try that.

The problem is that the validate method is asynchronous, so the flag is changed only after you return it, because the validation result was not awaited.

Here is a quick fix

    validateFirstTab: async function () {
      let flag = await this.$validator.validate();
      return flag;
    },