Vee-validate: ParsleyJs like validation

Created on 9 Sep 2017  ·  3Comments  ·  Source: logaretm/vee-validate

Versions:

  • VueJs: 2.4.2
  • Vee-Validate: latest RC

Description:

How to start real-time validation after the first click on the submit button. Like in ParsleyJs (Example). I am using Vue from cdn (No ES6). I tried this but the validation will stop after the first submit.

methods: {
  'sendMessage': function() {
    this.$validator.attach('name', 'required|min:3');
    this.$validator.attach('email', 'required|email');
    this.$validator.attach('password', 'required|min:7');
    this.$validator.validateAll().then((result) => {
      if (result) {
        // Send ajax
        return;
      }
    });
  }
}

Thanks.

❔ question 📚 docs

All 3 comments

Here is a small example I've created:

https://jsfiddle.net/logaretm/yxr3nehw/

There are a lot of undocumented API going there, I have added comments to the weird parts.

That is clever. I never thought about using Boolean value. Thanks a lot.
BTW: I am from Sudan.

Ah sister country, greetings to you.

Was this page helpful?
0 / 5 - 0 ratings