different validator
Check if the input value is different with given value
Options
Using with form field
(* denotes a required option)
Name | HTML attribute | Type | Description |
---|
compare * | data-fv-different___compare | String or a function returns a string | The value that the field has to be different with |
message | data-fv-different___message | String | The error message |
Using with ES6 module
import different from 'formvalidation/dist/es6/validators/different';
const result = different().validate({
value: ...,
options: {
compare: ...,
message: ...,
},
});
Basic example
The registration form below doesn't allow the username and password to be the same:
See also