2016-08-11 17:16:59 +08:00
|
|
|
{{< core_form/element-template }}
|
|
|
|
{{$element}}
|
2016-08-29 14:57:46 +08:00
|
|
|
{{^element.frozen}}
|
|
|
|
<input type="submit"
|
2016-08-11 17:16:59 +08:00
|
|
|
class="btn
|
2019-04-17 11:03:49 +08:00
|
|
|
{{^element.customclassoverride}}
|
2019-03-27 15:21:24 +08:00
|
|
|
{{^element.secondary}}btn-primary{{/element.secondary}}
|
|
|
|
{{#element.secondary}}btn-secondary{{/element.secondary}}
|
2019-04-17 11:03:49 +08:00
|
|
|
{{/element.customclassoverride}}
|
2019-03-27 15:21:24 +08:00
|
|
|
{{#error}} btn-danger {{/error}}
|
|
|
|
{{element.extraclasses}}
|
2019-04-17 11:03:49 +08:00
|
|
|
{{#element.customclassoverride}}{{element.customclassoverride}}{{/element.customclassoverride}}"
|
MDL-55417 forms: Render form elements with a template
This change allows form elements to be overridden with a mustache template.
The template can even listen for form validation errors and supply the JS to
change the look of the form element when there is/isn't a validation error.
Initial support is for all core form elements including:
text, select, selectyesno and checkboxes, groups, dateselector, datetimeselector,
autocomplete, modvisible, advcheckbox, button, duration, filemanager, filepicker, editor, static, grading,
warning, textarea, password, url, submit, questioncategory, recaptcha.
Part of MDL-55071
2016-08-04 22:29:32 +08:00
|
|
|
name="{{element.name}}"
|
|
|
|
id="{{element.id}}"
|
|
|
|
{{#error}}
|
2019-04-09 14:00:14 +02:00
|
|
|
autofocus aria-describedby="{{element.iderror}}"
|
MDL-55417 forms: Render form elements with a template
This change allows form elements to be overridden with a mustache template.
The template can even listen for form validation errors and supply the JS to
change the look of the form element when there is/isn't a validation error.
Initial support is for all core form elements including:
text, select, selectyesno and checkboxes, groups, dateselector, datetimeselector,
autocomplete, modvisible, advcheckbox, button, duration, filemanager, filepicker, editor, static, grading,
warning, textarea, password, url, submit, questioncategory, recaptcha.
Part of MDL-55071
2016-08-04 22:29:32 +08:00
|
|
|
{{/error}}
|
2016-08-11 17:16:59 +08:00
|
|
|
value="{{element.value}}"
|
|
|
|
{{{element.attributes}}} >
|
2016-08-29 14:57:46 +08:00
|
|
|
{{/element.frozen}}
|
2016-08-11 17:16:59 +08:00
|
|
|
{{/element}}
|
2016-08-16 13:53:04 +08:00
|
|
|
{{/ core_form/element-template }}
|
2019-08-22 11:21:34 +01:00
|
|
|
{{# js }}
|
|
|
|
{{^element.frozen}}
|
|
|
|
require(['core_form/submit'], function(Submit) {
|
|
|
|
Submit.init("{{ element.id }}");
|
|
|
|
});
|
|
|
|
{{/element.frozen}}
|
|
|
|
{{/ js }}
|