ein validator

Validate an EIN (Employer Identification Number)

Options

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

Basic example

ein validator

ES6 Module Example

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