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

Name HTML attribute Type Description
message data-fv-ein___message String The error message

Using with JavaScript module


// You might need to change the importing path
import ein from 'formvalidation/validators/ein';

const result = ein().validate({
    value: ...,
    options: {
        message: ...,
    },
});
/*
result is an object of
{
    valid: true or false,
    message: The error message     
}
*/

Basic Example

You can click on sample to see if it's a valid or invalid EIN.

Sample Is valid?
01-1234567
91-1144442
011234567
123-45-6789
00-1234567
07-1144442
49-1234567

Module Example

The following snippet shows how to use the ein validator with JavaScript module:


// You might need to change the importing path
import ein from 'formvalidation/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