grid validator

Validate a GRId (Global Release Identifier)

Options

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

Basic example

grid validator

ES6 Module Example

The following snippet shows how to use the grid validator with ES6 module:
// You might need to change the importing path
import grid from 'formvalidation/dist/es6/validators/grid';
const res1 = grid().validate({
value: 'A12425GABC1234002M',
options: {
message: 'The value is not valid GRId',
},
});
// res1.valid === true
const res2 = grid().validate({
value: 'A1-2425G-ABC1234002-Q',
options: {
message: 'The value is not valid GRId',
},
});
// res2.valid === false

See also