ismn validator

Validate an ISMN (International Standard Music 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-ismn___message String The error message

Using with JavaScript module


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

const result = ismn().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 ISMN.

Sample Is valid?
M230671187
979-0-0601-1561-5
979 0 3452 4680 5
9790060115615
9790060115614

Module Example

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


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

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

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

Related validators

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

Name Description
grid Validate a GRId (Global Release Identifier)