Delayed Validation (Debounced)

You can specify a delay to debounce the input event, a case scenario that you may want to wait for the user to stop typing then validate the field. This can be achieved by adding a data-delay attribute on the field being validated, and assign it the number of milliseconds you want to wait for.

Reject Invalid Files

After validating a file, you may want to reject the uploaded file if it fails the validation, this can be done by adding the reject modifier to directive. so you would use it like this: v-validate.reject.

Note: The reject modifier is only relevant on file inputs, adding it to other input types will not have an effect.

Validate $data

The basic approach relies on listening to the input or the change events depending on the file type. However most of the time, your values are bound to your Vue instance and some code may change their inputs programatically, the basic approach won't detect this change.

The Solution: The v-validate directive can take a binding expression, the expression is the data name you wish to validte. for example: <input v-validate="email" data-rules="required|email" type="text" name="email"> Whenever the binding value is updated, the validator will validate the new value automatically.

Note: The plugin will use the data in your vue instance as the source of the input value, meaning it won't be watching the input anymore. And as you noticed, you don't need to provide a name attribute, as the expression name will be used instead.

Note: Notice that the email field was immediatly validated when you open the page, you may not want this behavior, use the initial modifier to tell the validator to ignore the first evaluation like this: v-validate.initial.
For example the name field above didn't display any errors when you opened this page. This attribute is only relevant when validating using binding expressions, it has no effect otherwise.

Note: When you provide a binding expression to the directive, delay attribute and reject modifier won't have an effect anymore. so you might want to handle debouncing the inputs yourself.

Validate Form Before Submit

You may want to trigger all inputs validation before submitting a form, maybe display an alert or prevent form submission if any errors are detected.

Localized Messages

You may want to display error messages in different languages, here is an example on how you may do that. The language below is Arabic (RTL):

Note: Here we are also seeing data-as attribute which tells the validator to use that value as the field name when generating error messages, this is a good way to display 'pretty names' for your inputs in error messages, which would make sense when displaying messages in other languages.

Keep in mind that those pretty names are only used when generating error messages.