different validator
Return true if the input value is different with given field's value
Options
* — Required option
Option | HTML attribute | Type | Description |
---|---|---|---|
field * |
data-fv-different-field |
String | The name of field that will be used to compare with current
one. You also can indicate many fields which names are separated by a comma. |
message |
data-fv-different-message |
String | The error message |
When setting options via HTML attributes, remember to
enable the validator by setting data-fv-different="true".
The message and other options can be updated on the
fly via the updateMessage() and updateOption() methods
Take a look at the Asking fields to be unique example if
you want to compare more than two fields at the same time
From v0.6.0, you don't need to set different validator for all fields which you want them to be different to each other. For example, instead of using different validator for all fields as following
just set it to one of fields:
The plugin then will update the message, icon, status of fields properly when you change value any fields.
Example
The registration form below doesn't allow the username and password to be the same:
Related validators
The following validators might be useful to you: