imei validator

Validate an IMEI (International Mobile Station Equipment Identity)

Options

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

Basic example

imei validator

ES6 Module Example

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

See also