moodle_local_treestudyplan/templates/form/element_text_integer.mustache
2024-06-03 23:24:16 +02:00

44 lines
1.3 KiB
Plaintext

{{!
@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) {
formfields.textInteger({{#quote}}{{element.id}}{{/quote}},{{unsigned}},{{nonzero}});
});
{{/js}}