1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
| - (function ($, window, Drupal, drupalSettings) {
+ (function ($, window, Drupal, drupalSettings, once) {
Drupal.behaviors.bootstrapForm = {
attach: function (context) {
if (drupalSettings.bootstrap && drupalSettings.bootstrap.forms_has_error_value_toggle) {
- var $context = $(context);
- $context.find('.form-item.has-error:not(.form-type-password.has-feedback)').once('error').each(function () {
- const $elements = $(once('myfeature', '[data-myfeature]', context));
- var $formItem = $(this);
- var $input = $formItem.find(':input');
- $input.on('keyup focus blur', function () {
- if (this.defaultValue !== void 0) {
- $formItem[this.defaultValue !== this.value ? 'removeClass' : 'addClass']('has-error');
- $input[this.defaultValue !== this.value ? 'removeClass' : 'addClass']('error');
- }
- });
- });
+ const $elements = $(once('.form-item.has-error:not(.form-type-password.has-feedback)', 'error', context));
+ $elements.each(function () {
+ const $elements = $(once('myfeature', '[data-myfeature]', context));
+ var $formItem = $(this);
+ var $input = $formItem.find(':input');
+ $input.on('keyup focus blur', function () {
+ if (this.defaultValue !== void 0) {
+ $formItem[this.defaultValue !== this.value ? 'removeClass' : 'addClass']('has-error');
+ $input[this.defaultValue !== this.value ? 'removeClass' : 'addClass']('error');
+ }
+ });
+ });
}
}
};
- })(jQuery, this, Drupal, drupalSettings);
+ })(jQuery, this, Drupal, drupalSettings, once);
|