Skip to content

Link validations

Oscar edited this page Nov 12, 2018 · 3 revisions

This is a featured behaviour very useful to handle some cases and allows to validate other data when a validation ends.

Has to be taken in consideration that you can cause an infinite loop so pay attention when you define them.

The are three types of links:

Name Description
links It validates the defined path
linksThen Will validate the defined path only if the validation succeds
linksCatch Will validate the defined path only when the validation has an error

Example:

data: () => ({
   name: undefined,
   email: undefined,
   url: undefined
}),

vdRules: {
   name: { required: true, minlen: 3, links: 'email' },
   email: { required: true, type: 'email', linksThen: 'email' },
   url: { type: 'url' }
}

In the above code the email will be validated when the name ends the validation, and the url will be validated when the email ends the validation only if the email has no error.