MDL-55417 forms: Keep the JS for autocomplete in the template
[moodle.git] / theme / noname / templates / core_form / element-autocomplete.mustache
CommitLineData
344321e1
DW
1{{< core_form/element-template }}
2 {{$element}}
91bda4cd
DW
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}}
344321e1 10 {{{element.attributes}}} >
91bda4cd
DW
11 {{#element.options}}
12 <option value="{{value}}" {{#selected}}selected{{/selected}}>{{text}}</option>
13 {{/element.options}}
14 </select>
344321e1 15 {{/element}}
97a00c9b
DW
16{{/ core_form/element-template }}
17{{#js}}
18require(['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}}