isbn validator
Validate an ISBN (International Standard Book Number)
The validator support both ISBN 10 and ISBN 13.
Options
Using with form field
Name | HTML attribute | Type | Description |
---|
message | data-fv-isbn___message | String | The error message |
Using with ES6 module
import isbn from 'formvalidation/dist/es6/validators/isbn';
const result = isbn().validate({
value: ...,
options: {
message: ...,
},
});
Basic example
ES6 Module Example
The following snippet shows how to use the isbn validator with ES6 module:
import isbn from 'formvalidation/dist/es6/validators/isbn';
const res1 = isbn().validate({
value: '9971502100',
options: {
message: 'The value is not valid ISBN',
},
});
const res2 = isbn().validate({
value: '99921-58-10-6',
options: {
message: 'The value is not valid ISBN',
},
});
See also