isin validator

Validate an ISIN (International Securities 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-isin___message String The error message

Using with JavaScript module


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

const result = isin().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 ISIN.

Sample Is valid?
US0378331005
AU0000XVGZA3
GB0002634946
US0378331004
AA0000XVGZA3

Module Example

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


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

const res1 = isin().validate({
    value: 'US0378331005',
    options: {
        message: 'The value is not valid isin',
    },
});
// res1.valid === true

const res2 = isin().validate({
    value: 'AA0000XVGZA3',
    options: {
        message: 'The value is not valid isin',
    },
});
// res2.valid === false

Related validators

The following validators are similar to this one and might be useful to you.

Name Description
cusip Validate a CUSIP
sedol Validate a SEDOL (Stock Exchange Daily Official List)