different
| Category | Cross-field |
| Related | same |
| Bundle size | 253 B |
Validates that the value is different from another element's value.
Usage
vue
<VfText name="username" label="Username" />
<VfText name="display_name" label="Display name" rules="different:username" />vue
<template>
<VfText name="username" label="Username" />
<VfText name="display_name" label="Display name" rules="different:username" />
</template>ts
{
username: {
type: 'text',
label: 'Username',
},
display_name: {
type: 'text',
label: 'Display name',
rules: 'different:username',
},
}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_different_error | The {attribute} and {other} must be different. |