Sha256: 2ce9f416d0a1b7b83203d6705c74b8d3d2933d013a75a5c8b158abfa71fd5797
Contents?: true
Size: 1.44 KB
Versions: 4
Compression:
Stored size: 1.44 KB
Contents
(function($) { $.fn.bootstrapValidator.i18n.grid = $.extend($.fn.bootstrapValidator.i18n.grid || {}, { 'default': 'Please enter a valid GRId number' }); $.fn.bootstrapValidator.validators.grid = { /** * Validate GRId (Global Release Identifier) * Examples: * - Valid: A12425GABC1234002M, A1-2425G-ABC1234002-M, A1 2425G ABC1234002 M, Grid:A1-2425G-ABC1234002-M * - Invalid: A1-2425G-ABC1234002-Q * * @see http://en.wikipedia.org/wiki/Global_Release_Identifier * @param {BootstrapValidator} validator The validator plugin instance * @param {jQuery} $field Field element * @param {Object} options Can consist of the following keys: * - message: The invalid message * @returns {Boolean} */ validate: function(validator, $field, options) { var value = $field.val(); if (value === '') { return true; } value = value.toUpperCase(); if (!/^[GRID:]*([0-9A-Z]{2})[-\s]*([0-9A-Z]{5})[-\s]*([0-9A-Z]{10})[-\s]*([0-9A-Z]{1})$/g.test(value)) { return false; } value = value.replace(/\s/g, '').replace(/-/g, ''); if ('GRID:' === value.substr(0, 5)) { value = value.substr(5); } return $.fn.bootstrapValidator.helpers.mod37And36(value); } }; }(window.jQuery));
Version data entries
4 entries across 4 versions & 2 rubygems