Geoff
Geoff

Reputation: 6629

Vuejs vee validate validating all form inputs

Am mtrying to validate all inputs via

 this.validator.validateAll().then((result) => {
               console.log(result)
            }).catch(() => {
                // something went wrong (non-validation related).
                return false;
            });

But am getting an error

 Cannot read property 'then' of undefined

When i check on

console.log(this.validator)  

the function validateAll doesn't exists.Previously the above was working untill today

The following is my package.json dependency

 "devDependencies": {
     "vue": "^2.1.10"
  },

  "dependencies": {
    "vee-validate": "^2.0.0-rc.21",
   }

What could be wrong as it started throwing errors after running

npm install vee-validate --save

What do i need to do as it was previously working?

Upvotes: 0

Views: 1049

Answers (1)

Existe Deja
Existe Deja

Reputation: 1379

This.validator means you want to access to a Vue component property. But the plugin use this.$validator wich is an injected property by the plugin itself.

http://vee-validate.logaretm.com/examples.html#validate-form

Upvotes: 1

Related Questions