@template core/single_select Moodle template for a single select submit form. Context variables required for this template: * name - Element name. * method - get or post. * action - the action url to submit to. * classes - Element classes. * label - Element label. * disabled - true if this element is disabled. * title - Element title. * formid - optional id value for the form. * id - id for the element. * params - array of params with name and value attributes. * options - Array of options for the select with value, name , slected and optgroup properites. * labelattributes - Label attributes. * helpicon - Help icon. Example context (json): { "name": "lang", "method": "get", "action": "http://localhost/stable_master/mod/scorm/player.php", "classes": "langmenu", "label": "Zombies are coming...", "disabled": false, "title": null, "formid": "randomid", "id": "single_select5833dd4f4b08d108", "params": [ { "name": "scoid", "value": "12" }, { "name": "cm", "value": "15" }, { "name": "mode", "value": "review" }, { "name": "currentorg", "value": "eXeMapADrive4823c6301cf72b22b72" } ], "options": [ { "value": "en", "name": "English ‎(en)‎", "selected": true, "optgroup": false }, { "value": "ar", "name": "Muhaaaa..", "selected": false, "optgroup": false } ], "labelattributes": [], "helpicon": false } }}
{{#params}} {{/params}} {{#label}} {{/label}} {{#helpicon}} {{>core/help_icon}} {{/helpicon}}
{{#js}} require(['jquery', 'core/custom_interaction_events'], function($, CustomEvents) { CustomEvents.define('#{{id}}', [CustomEvents.events.accessibleChange]); $('#{{id}}').on(CustomEvents.events.accessibleChange, function() { var ignore = $(this).find(':selected').attr('data-ignore'); if (typeof ignore === typeof undefined) { $('#{{formid}}').submit(); } }); }); {{/js}}