K
K
kd241286zjv2019-02-25 12:43:30
Vue.js
kd241286zjv, 2019-02-25 12:43:30

How to use scope in vee-validate?

good afternoon!
there is a type code

<form @submit.prevent="authenticate('auth')" data-vv-scope="auth">
        <div class="formGroup">
          <label for="username">Введите логин</label>
          <input type="text" name="username" v-validate="'email'">
          <span class="inputError"  v-show="errors.first('auth.username')">Введите корректный адрес почты</span>
        </div>
        <div class="formGroup">
          <label for="password">Введите пароль</label>
          <input type="password" name="userPassword" v-validate="'min:6'">
          <span class="inputError"  v-show="errors.first('auth.userPassword')">Введите корректный пароль</span>
        </div>
        <input type="submit" value="Войти" class="btnBig">
      </form>

and js of the form
authenticate(scope){
        this.$validator.validate(scope).then(result => {
          if (!result) {
          }else{
            // do smthng
          }
        });

on submit I get Validating a non-existent field: "". Use "attach()" first.
what am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kd241286zjv, 2019-02-25
@kd241286zjv

this.$validator.validateAll(scope)
the problem was here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question