| 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 |
// You might need to change the importing path
import
identical
from
'formvalidation/dist/es6/validators/identical'
;
const
result
=
identical
(
)
.
validate
(
{
value
:
...
,
options
:
{
compare
:
...
,
message
:
...
,
}
,
}
)
;
/*
result is an object of
{
valid: true or false,
message: The error message
}
*/
identical
validator.