| Name | HTML attribute | Type | Description |
|---|---|---|---|
message
|
data-fv-isbn___message
|
String
|
The error message |
// You might need to change the importing path
import
isbn
from
'formvalidation/dist/es6/validators/isbn'
;
const
result
=
isbn
(
)
.
validate
(
{
value
:
...
,
options
:
{
message
:
...
,
}
,
}
)
;
/*
result is an object of
{
valid: true or false,
message: The error message,
meta: {
// Can be null (in case the value is not a valid ISBN) or ISBN10, ISBN13
type: ...
}
}
*/
// You might need to change the importing path
import
isbn
from
'formvalidation/dist/es6/validators/isbn'
;
const
res1
=
isbn
(
)
.
validate
(
{
value
:
'9971502100'
,
options
:
{
message
:
'The value is not valid ISBN'
,
}
,
}
)
;
// res1.valid === true
// res1.meta.type === 'ISBN10'
const
res2
=
isbn
(
)
.
validate
(
{
value
:
'99921-58-10-6'
,
options
:
{
message
:
'The value is not valid ISBN'
,
}
,
}
)
;
// res2.valid === false
// res2.meta.type === null