Sha256: 3245e860c525c5d9aef4896a5cec2b07d5068a30ee444735998a472112d57809
Contents?: true
Size: 1.36 KB
Versions: 4
Compression:
Stored size: 1.36 KB
Contents
(function($) { $.fn.bootstrapValidator.i18n.different = $.extend($.fn.bootstrapValidator.i18n.different || {}, { 'default': 'Please enter a different value' }); $.fn.bootstrapValidator.validators.different = { html5Attributes: { message: 'message', field: 'field' }, /** * Return true if the input value is different with given field's value * * @param {BootstrapValidator} validator The validator plugin instance * @param {jQuery} $field Field element * @param {Object} options Consists of the following key: * - field: The name of field that will be used to compare with current one * - message: The invalid message * @returns {Boolean} */ validate: function(validator, $field, options) { var value = $field.val(); if (value === '') { return true; } var compareWith = validator.getFieldElements(options.field); if (compareWith === null) { return true; } if (value !== compareWith.val()) { validator.updateStatus(options.field, validator.STATUS_VALID, 'different'); return true; } else { return false; } } }; }(window.jQuery));
Version data entries
4 entries across 4 versions & 2 rubygems