MDL-55417 forms: Keep the JS for autocomplete in the template
[moodle.git] / theme / noname / templates / core_form / element-autocomplete.mustache
1 {{< core_form/element-template }}
2     {{$element}}
3         <select class="custom-select {{#error}}form-control-danger{{/error}}" name="{{element.name}}"
4             id="{{element.id}}"
5             {{#element.multiple}}multiple{{/element.multiple}}
6             {{#element.frozen}}readonly disabled{{/element.frozen}}
7             {{#error}}
8                 autofocus aria-describedby="id_error_{{element.name}}"
9             {{/error}}
10             {{{element.attributes}}} >
11             {{#element.options}}
12             <option value="{{value}}" {{#selected}}selected{{/selected}}>{{text}}</option>
13             {{/element.options}}
14         </select>
15     {{/element}}
16 {{/ core_form/element-template }}
17 {{#js}}
18 require(['core/form-autocomplete'], function(module) {
19     module.enhance({{#quote}}#{{element.id}}{{/quote}},
20                    {{#quote}}{{element.tags}}{{/quote}},
21                    {{#quote}}{{element.ajax}}{{/quote}},
22                    {{#quote}}{{element.placeholder}}{{/quote}},
23                    {{#quote}}{{element.casesensitive}}{{/quote}},
24                    {{#quote}}{{element.showsuggestions}}{{/quote}},
25                    {{#quote}}{{element.noselectionstring}}{{/quote}});
26 });
27 {{/js}}