Validation State Values
There are two distinct structures present in vuelidate:
validationscomponent option - the definition of your validationv$ structure- an object in the Vue VM, that holds the validation state
The Validation state defines a set of properties which hold the output of user defined validation functions, following the provided validations property structure. The presence of those special reserved keywords means that you cannot specify your own validators with that name.
$invalid
Type:
BooleanDetails:
Indicates the state of validation for given model becomes
truewhen any of its child validators specified in options returns a falsy value.
$dirty
Type:
BooleanDetails:
A flag representing if the field under validation was touched by the user at least once. Usually it is used to decide if the message is supposed to be displayed to the end user. You can manage this flag manually by using $touch and
$resetmethods. It is set automatically when writing to$modelvalue. The$dirtyflag is considered true if given model was$touchedor all of its children are$dirty.
$anyDirty
Type:
BooleanDetails:
A flag very similar to
$dirty, with one exception. The$anyDirtyflag is consideredtrueif given model was$touchedor any of its children are$anyDirtywhich means at least one descendant is$dirty.
$model
Type:
anyDetails:
A reference to the original validated model. Reading this value will always give you exactly the same value as if you referenced the model directly. That means
this.v$.value.$modelis equivalent tothis.valuewhen read. Writing to that value will update the model and invoke$touchmethod automatically. This is very useful to use asv-modelpayload, providing a way of automatically marking given field as$dirtyon first touch. Pairs well with.lazymodifier.
$error
Type:
BooleanDetails:
Convenience flag to easily decide if a message should be displayed. Equivalent to
this.$dirty && !this.$pending && this.$invalid.
$errors
Type:
ArrayDetails:
Collection of all the error messages, collected for all child properties and nested forms (Vue components). Only contains errors from properties where
$dirtyequalstrue.
$silentErrors
Type:
ArrayDetails:
Collection of all the error messages, collected for all child properties and nested forms (Vue components).
$pending
Type:
BooleanDetails:
Indicates if any child async validator is currently pending. Always
falseif all validators are synchronous.
$params
Type:
ObjectDetails:
Contains types and parameters of all provided validators at the current level, as well as types and parameters of child validation groups, which may be declared using
withParams. Useful as an input to your error rendering system. Safe to use in translated text.
$response
Type:
Boolean | Object | NullDefault:
nullDetails:
Contains the response and rejections of a validator.
$path
Type:
StringDetails:
A dot notation nested path, of the current form leaf.