Search code examples
vue.jsvuejs2vee-validate

Cannot validate input fields in Vue.js


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.


Solution

  • 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;
        },