imo validator

Validate an IMO (International Maritime Organization)

Options

Using with form field
The HTML attributes are used to set the validator options via the Declarative plugin
NameHTML attributeTypeDescription
messagedata-fv-imo___messageStringThe error message
Using with ES6 module
// You might need to change the importing path
import imo from 'formvalidation/dist/es6/validators/imo';
const result = imo().validate({
value: ...,
options: {
message: ...,
},
});
/*
result is an object of
{
valid: true or false,
message: The error message
}
*/

Basic example

imo validator

ES6 Module Example

The following snippet shows how to use the imo validator with ES6 module:
// You might need to change the importing path
import imo from 'formvalidation/dist/es6/validators/imo';
const res1 = imo().validate({
value: 'IMO 9074729',
options: {
message: 'The value is not valid IMO',
},
});
// res1.valid === true
const res2 = imo().validate({
value: '9074729',
options: {
message: 'The value is not valid IMO',
},
});
// res2.valid === false