MDL-55417 forms: Keep the JS for autocomplete in the template
Part of MDL-55071
This commit is contained in:
committed by
Dan Poltawski
parent
4691b2d08e
commit
97a00c9b8e
@@ -209,10 +209,6 @@ class MoodleQuickForm_autocomplete extends MoodleQuickForm_select {
|
||||
global $PAGE;
|
||||
|
||||
$this->_generateId();
|
||||
$id = $this->getAttribute('id');
|
||||
$PAGE->requires->js_call_amd('core/form-autocomplete', 'enhance', $params = array('#' . $id, $this->tags, $this->ajax,
|
||||
$this->placeholder, $this->casesensitive, $this->showsuggestions, $this->noselectionstring));
|
||||
|
||||
$context = parent::export_for_template($output);
|
||||
$context['tags'] = $this->tags;
|
||||
$context['ajax'] = $this->ajax;
|
||||
|
||||
@@ -13,4 +13,15 @@
|
||||
{{/element.options}}
|
||||
</select>
|
||||
{{/element}}
|
||||
{{/ core_form/element-template }}
|
||||
{{/ core_form/element-template }}
|
||||
{{#js}}
|
||||
require(['core/form-autocomplete'], function(module) {
|
||||
module.enhance({{#quote}}#{{element.id}}{{/quote}},
|
||||
{{#quote}}{{element.tags}}{{/quote}},
|
||||
{{#quote}}{{element.ajax}}{{/quote}},
|
||||
{{#quote}}{{element.placeholder}}{{/quote}},
|
||||
{{#quote}}{{element.casesensitive}}{{/quote}},
|
||||
{{#quote}}{{element.showsuggestions}}{{/quote}},
|
||||
{{#quote}}{{element.noselectionstring}}{{/quote}});
|
||||
});
|
||||
{{/js}}
|
||||
|
||||
Reference in New Issue
Block a user