grid validator
Validate a GRId (Global Release Identifier)
Options
Using with form field
Name | HTML attribute | Type | Description |
---|
message | data-fv-grid___message | String | The error message |
Using the ES6 module
import { grid } from '/vendors/@form-validation/cjs/validator-grid';
const result = grid().validate({
value: ...,
options: {
message: ...,
},
});
Using the npm package
- Install the validator package:
$ npm install @form-validation/validator-grid
import { grid } from '@form-validation/validator-grid';
const result = grid().validate({
value: ...,
options: {
message: ...,
},
});
Basic example
NPM package example
The following snippet shows how to use the grid validator with the npm package:
import { grid } from '@form-validation/validator-grid';
const res1 = grid().validate({
value: 'A12425GABC1234002M',
options: {
message: 'The value is not valid GRId',
},
});
const res2 = grid().validate({
value: 'A1-2425G-ABC1234002-Q',
options: {
message: 'The value is not valid GRId',
},
});
See also
Changelog