ean validator
Validate an EAN (International Article Number)
Options
Using with form field
Name | HTML attribute | Type | Description |
---|
message | data-fv-ean___message | String | The error message |
Using with ES6 module
import ean from 'formvalidation/dist/es6/validators/ean';
const result = ean().validate({
value: ...,
options: {
message: ...,
},
});
Basic example
ES6 Module Example
The following snippet shows how to use the ean validator with ES6 module:
import ean from 'formvalidation/dist/es6/validators/ean';
const res1 = ean().validate({
value: '9780471117094',
options: {
message: 'The value is not valid EAN',
},
});
const res2 = ean().validate({
value: '73513536',
options: {
message: 'The value is not valid EAN',
},
});
See also
Changelog