same
| Category | Cross-field |
| Related | different · confirmed |
| Bundle size | 247 B |
Validates that the value is the same as another element's value.
Usage
vue
<VfText name="email" label="Email" rules="email" />
<VfText name="email_repeat" label="Repeat email" rules="same:email" />vue
<template>
<VfText name="email" label="Email" rules="email" />
<VfText name="email_repeat" label="Repeat email" rules="same:email" />
</template>ts
{
email: {
type: 'text',
label: 'Email',
rules: 'email',
},
email_repeat: {
type: 'text',
label: 'Repeat email',
rules: 'same:email',
},
}Parameters
| Parameter | Description |
|---|---|
other | The path of the element to compare against — see Referencing Other Elements. |
Behavior
While the referenced element is empty and not yet validated, the rule passes — the comparison only kicks in once the other element has been validated or the form is submitted.
Error Messages
| Key | Default Message |
|---|---|
rule_same_error | The {attribute} and {other} must match. |