identical validator
Check if the value is the same as one of given value
Options
Using with form field
(* denotes a required option)
Name | HTML attribute | Type | Description |
---|
compare * | data-fv-identical___compare | String or a function returns a string | The value that the field has to be different with |
message | data-fv-identical___message | String | The error message |
Using the ES6 module
import { identical } from '/vendors/@form-validation/cjs/validator-identical';
const result = identical().validate({
value: ...,
options: {
compare: ...,
message: ...,
},
});
Using the npm package
- Install the validator package:
$ npm install @form-validation/validator-identical
- Use the
identical
validator:
import { identical } from '@form-validation/validator-identical';
const result = identical().validate({
value: ...,
options: {
message: ...,
},
});
Basic example
The following form requires the password and confirmation one to be the same using identical
validator.
See also
Changelog