Added Text Input and "required" html tag

This commit is contained in:
Jan
2024-06-05 20:08:45 +02:00
parent 1b1b37d108
commit 71590b425b
2 changed files with 22 additions and 2 deletions

View File

@@ -16,6 +16,12 @@
{% endif %}
{%- endmacro %}
{% macro required(question) -%}
{% if (question["required"] == "true") %}
required
{% endif %}
{%- endmacro %}
{% macro input(name, value='', type='text', size=20) -%}
<input type="{{ type }}" name="{{ name }}" value="{{
value|e }}" size="{{ size }}">
@@ -47,12 +53,14 @@
<div class="likercontainer">
<div class="likert">
{% for point in questions[question]["points"] %}
<label><input name="likertscale" type="radio" value="{{ questions[question]['points'][point]['value'] }}"/><span>{{ questions[question]['points'][point]['text'] }}</span></label>
<label><input name="likertscale" type="radio" value="{{ questions[question]['points'][point]['value'] }}" {{required(questions[question])}}/><span>{{ questions[question]['points'][point]['text'] }}</span></label>
{% endfor %}
</div>
</div>
{% elif (questions[question]["type"] == "textinput") %}
<label for="{{ questions[question]['name'] }}">Additional Feedback: </label>
<textarea id="{{ questions[question]['name'] }}" name="{{ questions[question]['name'] }}" rows="3" cols="30" maxlength="{{ questions[question]['size'] }}" {{required(questions[question])}}></textarea>
{% else %}
<p>Error: Block {{config["question 1"]["blocks"][block]["type"]}} could not be loaded!</p>
{% endif %}