mart cube
mart cube

Reputation: 665

vee-validate 3.X - validate all forms - function

I used vee-validate with their previous version 2.X and I checked all forms validations with one function. I triggered my function on the submit button and if all forms are valid I allowed the submission. It looked something like this:

submit: function() {
  this.$validator.validateAll().then(result => {
    if (result) {
      // submit the form
    } else {
      return
    }
  })
},

Now with the new version 3.X a lot of things are changed. I looked in the docs but I could not find any example how can I check the validation of all forms. Does anyone have some function to share or a way how to do this good ?

Upvotes: 1

Views: 1538

Answers (1)

Teddy
Teddy

Reputation: 4243

It looks like you can wrap a ValidationObserver around many forms, and then trigger it using a validate() call:

Refer: https://logaretm.github.io/vee-validate/guide/validation-observer.html#examples

Upvotes: 1

Related Questions