Getting Started
Events

cusip validator

Validate a CUSIP 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-cusip___message String The error message
Using with ES6 module
            
// You might need to change the importing path
import cusip from 'formvalidation/dist/es6/validators/cusip' ;
const result = cusip ( ) . validate ( {
value : ... ,
options : {
message : ... ,
} ,
} ) ;
/*
result is an object of
{
valid: true or false,
message: The error message
}
*/

Basic example

cusip validator

ES6 Module Example

The following snippet shows how to use the cusip validator with ES6 module:
            
// You might need to change the importing path
import cusip from 'formvalidation/dist/es6/validators/cusip' ;
const res1 = cusip ( ) . validate ( {
value : '037833100' ,
options : {
message : 'The value is not valid CUSIP' ,
} ,
} ) ;
// res1.valid === true
const res2 = cusip ( ) . validate ( {
value : '31430F200' ,
options : {
message : 'The value is not valid CUSIP' ,
} ,
} ) ;
// res2.valid === false

See also

Changelog

v1.7.0
  • Fixed an issue that the cusip validator doesn't work properly