Turn off autocomplete in JS for suggested elements

Instead of the PHP code, for all input.director-suggest elements
This commit is contained in:
Markus Frosch 2018-08-07 11:34:07 +02:00 committed by Thomas Gelf
parent 5dacabd437
commit f63ee93f71
2 changed files with 11 additions and 4 deletions

View File

@ -207,10 +207,6 @@ class ExtensibleSetElement extends BaseHtmlElement
$attrs = $element->getAttributes();
$attrs->add('class', 'director-suggest');
$attrs->set([
'autocomplete' => 'off',
'autocorrect' => 'off',
'autocapitalize' => 'off',
'spellcheck' => 'false',
'data-suggestion-context' => $this->suggestionContext,
]);
}

View File

@ -677,6 +677,9 @@
if (! this.containerIsAutorefreshed($container) && ! this.containerIsAutoSubmitted($container)) {
this.putFocusOnFirstFormElement($container);
}
// Turn off autocomplete for all suggested fields
$container.find('input.director-suggest').each(this.disableAutocomplete);
},
highlightActiveDashlet: function($container)
@ -789,6 +792,14 @@
} else {
$fieldset.find('legend span.element-count').remove();
}
},
disableAutocomplete: function() {
$(this)
.attr('autocomplete', 'off')
.attr('autocorrect', 'off')
.attr('autocapitalize', 'off')
.attr('spellcheck', 'false');
}
};