Vee-validate: Validation rules don't exist

Created on 5 Sep 2019  路  4Comments  路  Source: logaretm/vee-validate

Versions

  • vee-validate: 3.0.3
  • vue: 2.#.#

Describe the bug
Passing one of the pre-defined rules to the ValidationProvider component throws an errors that the rules does not exist.

To reproduce
Steps to reproduce the behavior:

  1. Import the Observer and Provider component.
  2. Wrap an input inside the provider component
  3. Add rules prop to the provider component with, "required/max"
  4. See an errors thrown, "Uncaught (in promise) Error: No such validator 'required' exists."

Expected behavior
Pre-defined validation rules work.

Code Snippet

<template>
  <ValidationObserver>
    <ValidationProvider :rules="{ required: true }">
      <input
        v-model="name"
        type="text"
      >
    </ValidationProvider>
  </ValidationObserver>
</template>

<script>
import {
  ValidationProvider,
  ValidationObserver,
} from 'vee-validate';

export default {
  components: {
    ValidationProvider,
    ValidationObserver,
  },

  data: () => ({
    name: '',
  }),
};
</script>

Desktop:

  • OS: OSX
  • Browser Chrome

Most helpful comment

Now VeeValidate requires you to import the rules yourself. So you can either import them rule by rule:

import { required, email } from 'vee-validate/dist/rules';

or you can import all rules once using:

import {
  ValidationProvider,
  ValidationObserver
} from 'vee-validate/dist/vee-validate.full';

Further reading:
https://baianat.github.io/vee-validate/guide/basic-validation.html#importing-validation-rules

All 4 comments

Now VeeValidate requires you to import the rules yourself. So you can either import them rule by rule:

import { required, email } from 'vee-validate/dist/rules';

or you can import all rules once using:

import {
  ValidationProvider,
  ValidationObserver
} from 'vee-validate/dist/vee-validate.full';

Further reading:
https://baianat.github.io/vee-validate/guide/basic-validation.html#importing-validation-rules

@1nchHigh Thanks!

ValidationObserver

its helped even in sep 2020~~

Now VeeValidate requires you to import the rules yourself. So you can either import them rule by rule:

import { required, email } from 'vee-validate/dist/rules';

or you can import all rules once using:

import {
  ValidationProvider,
  ValidationObserver
} from 'vee-validate/dist/vee-validate.full';

Further reading:
https://baianat.github.io/vee-validate/guide/basic-validation.html#importing-validation-rules

Thanks Dude for your help

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Hoagiex picture Hoagiex  路  3Comments

MeltedFreddo picture MeltedFreddo  路  3Comments

the94air picture the94air  路  3Comments

schel4ok picture schel4ok  路  3Comments

HunterJS-bit picture HunterJS-bit  路  3Comments