bootstrap_validator_rails 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bootstrap_validator_rails/version.rb +1 -1
  3. data/vendor/assets/javascripts/bootstrapValidator.js +4677 -2
  4. data/vendor/assets/javascripts/bootstrapValidator.min.js +12 -0
  5. data/vendor/assets/stylesheets/bootstrapValidator.min.css +11 -0
  6. metadata +4 -48
  7. data/vendor/assets/javascripts/validator/base64.js +0 -25
  8. data/vendor/assets/javascripts/validator/between.js +0 -66
  9. data/vendor/assets/javascripts/validator/callback.js +0 -40
  10. data/vendor/assets/javascripts/validator/choice.js +0 -68
  11. data/vendor/assets/javascripts/validator/creditCard.js +0 -103
  12. data/vendor/assets/javascripts/validator/cusip.js +0 -55
  13. data/vendor/assets/javascripts/validator/cvv.js +0 -116
  14. data/vendor/assets/javascripts/validator/date.js +0 -118
  15. data/vendor/assets/javascripts/validator/different.js +0 -41
  16. data/vendor/assets/javascripts/validator/digits.js +0 -24
  17. data/vendor/assets/javascripts/validator/ean.js +0 -40
  18. data/vendor/assets/javascripts/validator/emailAddress.js +0 -31
  19. data/vendor/assets/javascripts/validator/file.js +0 -69
  20. data/vendor/assets/javascripts/validator/greaterThan.js +0 -61
  21. data/vendor/assets/javascripts/validator/grid.js +0 -37
  22. data/vendor/assets/javascripts/validator/hex.js +0 -25
  23. data/vendor/assets/javascripts/validator/hexColor.js +0 -28
  24. data/vendor/assets/javascripts/validator/iban.js +0 -246
  25. data/vendor/assets/javascripts/validator/id.js +0 -815
  26. data/vendor/assets/javascripts/validator/identical.js +0 -40
  27. data/vendor/assets/javascripts/validator/imei.js +0 -44
  28. data/vendor/assets/javascripts/validator/integer.js +0 -28
  29. data/vendor/assets/javascripts/validator/ip.js +0 -48
  30. data/vendor/assets/javascripts/validator/isbn.js +0 -86
  31. data/vendor/assets/javascripts/validator/isin.js +0 -59
  32. data/vendor/assets/javascripts/validator/ismn.js +0 -59
  33. data/vendor/assets/javascripts/validator/issn.js +0 -46
  34. data/vendor/assets/javascripts/validator/lessThan.js +0 -61
  35. data/vendor/assets/javascripts/validator/mac.js +0 -25
  36. data/vendor/assets/javascripts/validator/notEmpty.js +0 -32
  37. data/vendor/assets/javascripts/validator/numeric.js +0 -39
  38. data/vendor/assets/javascripts/validator/phone.js +0 -84
  39. data/vendor/assets/javascripts/validator/regexp.js +0 -42
  40. data/vendor/assets/javascripts/validator/remote.js +0 -70
  41. data/vendor/assets/javascripts/validator/rtn.js +0 -38
  42. data/vendor/assets/javascripts/validator/sedol.js +0 -40
  43. data/vendor/assets/javascripts/validator/siren.js +0 -28
  44. data/vendor/assets/javascripts/validator/siret.js +0 -38
  45. data/vendor/assets/javascripts/validator/step.js +0 -64
  46. data/vendor/assets/javascripts/validator/stringCase.js +0 -36
  47. data/vendor/assets/javascripts/validator/stringLength.js +0 -81
  48. data/vendor/assets/javascripts/validator/uri.js +0 -101
  49. data/vendor/assets/javascripts/validator/uuid.js +0 -46
  50. data/vendor/assets/javascripts/validator/vat.js +0 -1220
  51. data/vendor/assets/javascripts/validator/vin.js +0 -49
  52. data/vendor/assets/javascripts/validator/zipCode.js +0 -162
@@ -1,40 +0,0 @@
1
- (function($) {
2
- $.fn.bootstrapValidator.i18n.identical = $.extend($.fn.bootstrapValidator.i18n.identical || {}, {
3
- 'default': 'Please enter the same value'
4
- });
5
-
6
- $.fn.bootstrapValidator.validators.identical = {
7
- html5Attributes: {
8
- message: 'message',
9
- field: 'field'
10
- },
11
-
12
- /**
13
- * Check if input value equals to value of particular one
14
- *
15
- * @param {BootstrapValidator} validator The validator plugin instance
16
- * @param {jQuery} $field Field element
17
- * @param {Object} options Consists of the following key:
18
- * - field: The name of field that will be used to compare with current one
19
- * @returns {Boolean}
20
- */
21
- validate: function(validator, $field, options) {
22
- var value = $field.val();
23
- if (value === '') {
24
- return true;
25
- }
26
-
27
- var compareWith = validator.getFieldElements(options.field);
28
- if (compareWith === null) {
29
- return true;
30
- }
31
-
32
- if (value === compareWith.val()) {
33
- validator.updateStatus(options.field, validator.STATUS_VALID, 'identical');
34
- return true;
35
- } else {
36
- return false;
37
- }
38
- }
39
- };
40
- }(window.jQuery));
@@ -1,44 +0,0 @@
1
- (function($) {
2
- $.fn.bootstrapValidator.i18n.imei = $.extend($.fn.bootstrapValidator.i18n.imei || {}, {
3
- 'default': 'Please enter a valid IMEI number'
4
- });
5
-
6
- $.fn.bootstrapValidator.validators.imei = {
7
- /**
8
- * Validate IMEI (International Mobile Station Equipment Identity)
9
- * Examples:
10
- * - Valid: 35-209900-176148-1, 35-209900-176148-23, 3568680000414120, 490154203237518
11
- * - Invalid: 490154203237517
12
- *
13
- * @see http://en.wikipedia.org/wiki/International_Mobile_Station_Equipment_Identity
14
- * @param {BootstrapValidator} validator The validator plugin instance
15
- * @param {jQuery} $field Field element
16
- * @param {Object} options Can consist of the following keys:
17
- * - message: The invalid message
18
- * @returns {Boolean}
19
- */
20
- validate: function(validator, $field, options) {
21
- var value = $field.val();
22
- if (value === '') {
23
- return true;
24
- }
25
-
26
- switch (true) {
27
- case /^\d{15}$/.test(value):
28
- case /^\d{2}-\d{6}-\d{6}-\d{1}$/.test(value):
29
- case /^\d{2}\s\d{6}\s\d{6}\s\d{1}$/.test(value):
30
- value = value.replace(/[^0-9]/g, '');
31
- return $.fn.bootstrapValidator.helpers.luhn(value);
32
-
33
- case /^\d{14}$/.test(value):
34
- case /^\d{16}$/.test(value):
35
- case /^\d{2}-\d{6}-\d{6}(|-\d{2})$/.test(value):
36
- case /^\d{2}\s\d{6}\s\d{6}(|\s\d{2})$/.test(value):
37
- return true;
38
-
39
- default:
40
- return false;
41
- }
42
- }
43
- };
44
- }(window.jQuery));
@@ -1,28 +0,0 @@
1
- (function($) {
2
- $.fn.bootstrapValidator.i18n.integer = $.extend($.fn.bootstrapValidator.i18n.integer || {}, {
3
- 'default': 'Please enter a valid number'
4
- });
5
-
6
- $.fn.bootstrapValidator.validators.integer = {
7
- enableByHtml5: function($field) {
8
- return ('number' === $field.attr('type')) && ($field.attr('step') === undefined || $field.attr('step') % 1 === 0);
9
- },
10
-
11
- /**
12
- * Return true if the input value is an integer
13
- *
14
- * @param {BootstrapValidator} validator The validator plugin instance
15
- * @param {jQuery} $field Field element
16
- * @param {Object} options Can consist of the following key:
17
- * - message: The invalid message
18
- * @returns {Boolean}
19
- */
20
- validate: function(validator, $field, options) {
21
- var value = $field.val();
22
- if (value === '') {
23
- return true;
24
- }
25
- return /^(?:-?(?:0|[1-9][0-9]*))$/.test(value);
26
- }
27
- };
28
- }(window.jQuery));
@@ -1,48 +0,0 @@
1
- (function($) {
2
- $.fn.bootstrapValidator.i18n.ip = $.extend($.fn.bootstrapValidator.i18n.ip || {}, {
3
- 'default': 'Please enter a valid IP address',
4
- ipv4: 'Please enter a valid IPv4 address',
5
- ipv6: 'Please enter a valid IPv6 address'
6
- });
7
-
8
- $.fn.bootstrapValidator.validators.ip = {
9
- html5Attributes: {
10
- message: 'message',
11
- ipv4: 'ipv4',
12
- ipv6: 'ipv6'
13
- },
14
-
15
- /**
16
- * Return true if the input value is a IP address.
17
- *
18
- * @param {BootstrapValidator} validator The validator plugin instance
19
- * @param {jQuery} $field Field element
20
- * @param {Object} options Can consist of the following keys:
21
- * - ipv4: Enable IPv4 validator, default to true
22
- * - ipv6: Enable IPv6 validator, default to true
23
- * - message: The invalid message
24
- * @returns {Boolean|Object}
25
- */
26
- validate: function(validator, $field, options) {
27
- var value = $field.val();
28
- if (value === '') {
29
- return true;
30
- }
31
- options = $.extend({}, { ipv4: true, ipv6: true }, options);
32
-
33
- if (options.ipv4) {
34
- return {
35
- valid: /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(value),
36
- message: options.message || $.fn.bootstrapValidator.i18n.ip.ipv4
37
- };
38
- } else if (options.ipv6) {
39
- return {
40
- valid: /^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/.test(value),
41
- message: options.message || $.fn.bootstrapValidator.i18n.ip.ipv6
42
- };
43
- }
44
-
45
- return false;
46
- }
47
- };
48
- }(window.jQuery));
@@ -1,86 +0,0 @@
1
- (function($) {
2
- $.fn.bootstrapValidator.i18n.isbn = $.extend($.fn.bootstrapValidator.i18n.isbn || {}, {
3
- 'default': 'Please enter a valid ISBN number'
4
- });
5
-
6
- $.fn.bootstrapValidator.validators.isbn = {
7
- /**
8
- * Return true if the input value is a valid ISBN 10 or ISBN 13 number
9
- * Examples:
10
- * - Valid:
11
- * ISBN 10: 99921-58-10-7, 9971-5-0210-0, 960-425-059-0, 80-902734-1-6, 85-359-0277-5, 1-84356-028-3, 0-684-84328-5, 0-8044-2957-X, 0-85131-041-9, 0-943396-04-2, 0-9752298-0-X
12
- * ISBN 13: 978-0-306-40615-7
13
- * - Invalid:
14
- * ISBN 10: 99921-58-10-6
15
- * ISBN 13: 978-0-306-40615-6
16
- *
17
- * @see http://en.wikipedia.org/wiki/International_Standard_Book_Number
18
- * @param {BootstrapValidator} validator The validator plugin instance
19
- * @param {jQuery} $field Field element
20
- * @param {Object} [options] Can consist of the following keys:
21
- * - message: The invalid message
22
- * @returns {Boolean}
23
- */
24
- validate: function(validator, $field, options) {
25
- var value = $field.val();
26
- if (value === '') {
27
- return true;
28
- }
29
-
30
- // http://en.wikipedia.org/wiki/International_Standard_Book_Number#Overview
31
- // Groups are separated by a hyphen or a space
32
- var type;
33
- switch (true) {
34
- case /^\d{9}[\dX]$/.test(value):
35
- case (value.length === 13 && /^(\d+)-(\d+)-(\d+)-([\dX])$/.test(value)):
36
- case (value.length === 13 && /^(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(value)):
37
- type = 'ISBN10';
38
- break;
39
- case /^(978|979)\d{9}[\dX]$/.test(value):
40
- case (value.length === 17 && /^(978|979)-(\d+)-(\d+)-(\d+)-([\dX])$/.test(value)):
41
- case (value.length === 17 && /^(978|979)\s(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(value)):
42
- type = 'ISBN13';
43
- break;
44
- default:
45
- return false;
46
- }
47
-
48
- // Replace all special characters except digits and X
49
- value = value.replace(/[^0-9X]/gi, '');
50
- var chars = value.split(''),
51
- length = chars.length,
52
- sum = 0,
53
- i,
54
- checksum;
55
-
56
- switch (type) {
57
- case 'ISBN10':
58
- sum = 0;
59
- for (i = 0; i < length - 1; i++) {
60
- sum += parseInt(chars[i], 10) * (10 - i);
61
- }
62
- checksum = 11 - (sum % 11);
63
- if (checksum === 11) {
64
- checksum = 0;
65
- } else if (checksum === 10) {
66
- checksum = 'X';
67
- }
68
- return (checksum + '' === chars[length - 1]);
69
-
70
- case 'ISBN13':
71
- sum = 0;
72
- for (i = 0; i < length - 1; i++) {
73
- sum += ((i % 2 === 0) ? parseInt(chars[i], 10) : (parseInt(chars[i], 10) * 3));
74
- }
75
- checksum = 10 - (sum % 10);
76
- if (checksum === 10) {
77
- checksum = '0';
78
- }
79
- return (checksum + '' === chars[length - 1]);
80
-
81
- default:
82
- return false;
83
- }
84
- }
85
- };
86
- }(window.jQuery));
@@ -1,59 +0,0 @@
1
- (function($) {
2
- $.fn.bootstrapValidator.i18n.isin = $.extend($.fn.bootstrapValidator.i18n.isin || {}, {
3
- 'default': 'Please enter a valid ISIN number'
4
- });
5
-
6
- $.fn.bootstrapValidator.validators.isin = {
7
- // Available country codes
8
- // See http://isin.net/country-codes/
9
- COUNTRY_CODES: 'AF|AX|AL|DZ|AS|AD|AO|AI|AQ|AG|AR|AM|AW|AU|AT|AZ|BS|BH|BD|BB|BY|BE|BZ|BJ|BM|BT|BO|BQ|BA|BW|BV|BR|IO|BN|BG|BF|BI|KH|CM|CA|CV|KY|CF|TD|CL|CN|CX|CC|CO|KM|CG|CD|CK|CR|CI|HR|CU|CW|CY|CZ|DK|DJ|DM|DO|EC|EG|SV|GQ|ER|EE|ET|FK|FO|FJ|FI|FR|GF|PF|TF|GA|GM|GE|DE|GH|GI|GR|GL|GD|GP|GU|GT|GG|GN|GW|GY|HT|HM|VA|HN|HK|HU|IS|IN|ID|IR|IQ|IE|IM|IL|IT|JM|JP|JE|JO|KZ|KE|KI|KP|KR|KW|KG|LA|LV|LB|LS|LR|LY|LI|LT|LU|MO|MK|MG|MW|MY|MV|ML|MT|MH|MQ|MR|MU|YT|MX|FM|MD|MC|MN|ME|MS|MA|MZ|MM|NA|NR|NP|NL|NC|NZ|NI|NE|NG|NU|NF|MP|NO|OM|PK|PW|PS|PA|PG|PY|PE|PH|PN|PL|PT|PR|QA|RE|RO|RU|RW|BL|SH|KN|LC|MF|PM|VC|WS|SM|ST|SA|SN|RS|SC|SL|SG|SX|SK|SI|SB|SO|ZA|GS|SS|ES|LK|SD|SR|SJ|SZ|SE|CH|SY|TW|TJ|TZ|TH|TL|TG|TK|TO|TT|TN|TR|TM|TC|TV|UG|UA|AE|GB|US|UM|UY|UZ|VU|VE|VN|VG|VI|WF|EH|YE|ZM|ZW',
10
-
11
- /**
12
- * Validate an ISIN (International Securities Identification Number)
13
- * Examples:
14
- * - Valid: US0378331005, AU0000XVGZA3, GB0002634946
15
- * - Invalid: US0378331004, AA0000XVGZA3
16
- *
17
- * @see http://en.wikipedia.org/wiki/International_Securities_Identifying_Number
18
- * @param {BootstrapValidator} validator The validator plugin instance
19
- * @param {jQuery} $field Field element
20
- * @param {Object} options Can consist of the following keys:
21
- * - message: The invalid message
22
- * @returns {Boolean}
23
- */
24
- validate: function(validator, $field, options) {
25
- var value = $field.val();
26
- if (value === '') {
27
- return true;
28
- }
29
-
30
- value = value.toUpperCase();
31
- var regex = new RegExp('^(' + this.COUNTRY_CODES + ')[0-9A-Z]{10}$');
32
- if (!regex.test(value)) {
33
- return false;
34
- }
35
-
36
- var converted = '',
37
- length = value.length;
38
- // Convert letters to number
39
- for (var i = 0; i < length - 1; i++) {
40
- var c = value.charCodeAt(i);
41
- converted += ((c > 57) ? (c - 55).toString() : value.charAt(i));
42
- }
43
-
44
- var digits = '',
45
- n = converted.length,
46
- group = (n % 2 !== 0) ? 0 : 1;
47
- for (i = 0; i < n; i++) {
48
- digits += (parseInt(converted[i], 10) * ((i % 2) === group ? 2 : 1) + '');
49
- }
50
-
51
- var sum = 0;
52
- for (i = 0; i < digits.length; i++) {
53
- sum += parseInt(digits.charAt(i), 10);
54
- }
55
- sum = (10 - (sum % 10)) % 10;
56
- return sum + '' === value.charAt(length - 1);
57
- }
58
- };
59
- }(window.jQuery));
@@ -1,59 +0,0 @@
1
- (function($) {
2
- $.fn.bootstrapValidator.i18n.ismn = $.extend($.fn.bootstrapValidator.i18n.ismn || {}, {
3
- 'default': 'Please enter a valid ISMN number'
4
- });
5
-
6
- $.fn.bootstrapValidator.validators.ismn = {
7
- /**
8
- * Validate ISMN (International Standard Music Number)
9
- * Examples:
10
- * - Valid: M230671187, 979-0-0601-1561-5, 979 0 3452 4680 5, 9790060115615
11
- * - Invalid: 9790060115614
12
- *
13
- * @see http://en.wikipedia.org/wiki/International_Standard_Music_Number
14
- * @param {BootstrapValidator} validator The validator plugin instance
15
- * @param {jQuery} $field Field element
16
- * @param {Object} options Can consist of the following keys:
17
- * - message: The invalid message
18
- * @returns {Boolean}
19
- */
20
- validate: function(validator, $field, options) {
21
- var value = $field.val();
22
- if (value === '') {
23
- return true;
24
- }
25
-
26
- // Groups are separated by a hyphen or a space
27
- var type;
28
- switch (true) {
29
- case /^M\d{9}$/.test(value):
30
- case /^M-\d{4}-\d{4}-\d{1}$/.test(value):
31
- case /^M\s\d{4}\s\d{4}\s\d{1}$/.test(value):
32
- type = 'ISMN10';
33
- break;
34
- case /^9790\d{9}$/.test(value):
35
- case /^979-0-\d{4}-\d{4}-\d{1}$/.test(value):
36
- case /^979\s0\s\d{4}\s\d{4}\s\d{1}$/.test(value):
37
- type = 'ISMN13';
38
- break;
39
- default:
40
- return false;
41
- }
42
-
43
- if ('ISMN10' === type) {
44
- value = '9790' + value.substr(1);
45
- }
46
-
47
- // Replace all special characters except digits
48
- value = value.replace(/[^0-9]/gi, '');
49
- var length = value.length,
50
- sum = 0,
51
- weight = [1, 3];
52
- for (var i = 0; i < length - 1; i++) {
53
- sum += parseInt(value.charAt(i), 10) * weight[i % 2];
54
- }
55
- sum = 10 - sum % 10;
56
- return (sum + '' === value.charAt(length - 1));
57
- }
58
- };
59
- }(window.jQuery));
@@ -1,46 +0,0 @@
1
- (function($) {
2
- $.fn.bootstrapValidator.i18n.issn = $.extend($.fn.bootstrapValidator.i18n.issn || {}, {
3
- 'default': 'Please enter a valid ISSN number'
4
- });
5
-
6
- $.fn.bootstrapValidator.validators.issn = {
7
- /**
8
- * Validate ISSN (International Standard Serial Number)
9
- * Examples:
10
- * - Valid: 0378-5955, 0024-9319, 0032-1478
11
- * - Invalid: 0032-147X
12
- *
13
- * @see http://en.wikipedia.org/wiki/International_Standard_Serial_Number
14
- * @param {BootstrapValidator} validator The validator plugin instance
15
- * @param {jQuery} $field Field element
16
- * @param {Object} options Can consist of the following keys:
17
- * - message: The invalid message
18
- * @returns {Boolean}
19
- */
20
- validate: function(validator, $field, options) {
21
- var value = $field.val();
22
- if (value === '') {
23
- return true;
24
- }
25
-
26
- // Groups are separated by a hyphen or a space
27
- if (!/^\d{4}\-\d{3}[\dX]$/.test(value)) {
28
- return false;
29
- }
30
-
31
- // Replace all special characters except digits and X
32
- value = value.replace(/[^0-9X]/gi, '');
33
- var chars = value.split(''),
34
- length = chars.length,
35
- sum = 0;
36
-
37
- if (chars[7] === 'X') {
38
- chars[7] = 10;
39
- }
40
- for (var i = 0; i < length; i++) {
41
- sum += parseInt(chars[i], 10) * (8 - i);
42
- }
43
- return (sum % 11 === 0);
44
- }
45
- };
46
- }(window.jQuery));
@@ -1,61 +0,0 @@
1
- (function($) {
2
- $.fn.bootstrapValidator.i18n.lessThan = $.extend($.fn.bootstrapValidator.i18n.lessThan || {}, {
3
- 'default': 'Please enter a value less than or equal to %s',
4
- notInclusive: 'Please enter a value less than %s'
5
- });
6
-
7
- $.fn.bootstrapValidator.validators.lessThan = {
8
- html5Attributes: {
9
- message: 'message',
10
- value: 'value',
11
- inclusive: 'inclusive'
12
- },
13
-
14
- enableByHtml5: function($field) {
15
- var max = $field.attr('max');
16
- if (max) {
17
- return {
18
- value: max
19
- };
20
- }
21
-
22
- return false;
23
- },
24
-
25
- /**
26
- * Return true if the input value is less than or equal to given number
27
- *
28
- * @param {BootstrapValidator} validator The validator plugin instance
29
- * @param {jQuery} $field Field element
30
- * @param {Object} options Can consist of the following keys:
31
- * - value: The number used to compare to. It can be
32
- * - A number
33
- * - Name of field which its value defines the number
34
- * - Name of callback function that returns the number
35
- * - A callback function that returns the number
36
- *
37
- * - inclusive [optional]: Can be true or false. Default is true
38
- * - message: The invalid message
39
- * @returns {Boolean|Object}
40
- */
41
- validate: function(validator, $field, options) {
42
- var value = $field.val();
43
- if (value === '') {
44
- return true;
45
- }
46
-
47
- var compareTo = $.isNumeric(options.value) ? options.value : validator.getDynamicOption($field, options.value);
48
-
49
- value = parseFloat(value);
50
- return (options.inclusive === true || options.inclusive === undefined)
51
- ? {
52
- valid: value <= compareTo,
53
- message: $.fn.bootstrapValidator.helpers.format(options.message || $.fn.bootstrapValidator.i18n.lessThan['default'], compareTo)
54
- }
55
- : {
56
- valid: value < compareTo,
57
- message: $.fn.bootstrapValidator.helpers.format(options.message || $.fn.bootstrapValidator.i18n.lessThan.notInclusive, compareTo)
58
- };
59
- }
60
- };
61
- }(window.jQuery));