Sha256: 4bb1e8950dd7fd424c569a17cf1a01f8e22d560d6d47663539156e491ea1a0fb

Contents?: true

Size: 847 Bytes

Versions: 4

Compression:

Stored size: 847 Bytes

Contents

(function($) {
    $.fn.bootstrapValidator.i18n.hex = $.extend($.fn.bootstrapValidator.i18n.hex || {}, {
        'default': 'Please enter a valid hexadecimal number'
    });

    $.fn.bootstrapValidator.validators.hex = {
        /**
         * Return true if and only if the input value is a valid hexadecimal number
         *
         * @param {BootstrapValidator} validator The validator plugin instance
         * @param {jQuery} $field Field element
         * @param {Object} options Consist of key:
         * - message: The invalid message
         * @returns {Boolean}
         */
        validate: function(validator, $field, options) {
            var value = $field.val();
            if (value === '') {
                return true;
            }

            return /^[0-9a-fA-F]+$/.test(value);
        }
    };
}(window.jQuery));

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
bootstrap_validator_rails-0.1.0 vendor/assets/javascripts/validator/hex.js
bootstrap_validator_rails-0.0.6 vendor/assets/javascripts/validator/hex.js
bootstrap_validator_rails-0.0.5 vendor/assets/javascripts/validator/hex.js
bootstrap_validator-rails-0.0.1 vendor/javascripts/validator/hex.js