moodle_local_treestudyplan/templates/form/element_text_integer.mustache

44 lines
1.3 KiB
Text
Raw Normal View History

2024-06-03 23:24:16 +02:00
{{!
@template local_treestudyplan/element_text_integer
Template for integer only field
Example context (json):
{
"element": {
"name": "test",
"id": "test0",
"size": null,
"error": null,
"value": "Sample text",
"frozen": false,
"hardfrozen": false,
"iderror": "test0_error",
"attributes": ""
},
"unsigned": true,
"nonzero": true
}
}}
{{< core_form/element-template }}
{{$element}}
<input type="text"
class="form-control {{#error}}is-invalid{{/error}}"
name="{{element.name}}"
{{#element.frozen}}
readonly {{#element.hardfrozen}}disabled{{/element.hardfrozen}}
{{/element.frozen}}
id="{{element.id}}"
value="{{element.value}}"
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{{element.attributes}}} >
{{/element}}
{{/ core_form/element-template }}
{{#js}}
require(['local_treestudyplan/util/formfields'], function(formfields) {
2024-07-19 17:48:21 +02:00
formfields.textInteger({{#quote}}{{element.id}}{{/quote}}, {{unsigned}}, {{nonzero}});
});
{{/js}}