diff --git a/slaeforms/default.json b/slaeforms/default.json index 3dada63..a2e02de 100644 --- a/slaeforms/default.json +++ b/slaeforms/default.json @@ -19,6 +19,7 @@ "question1":{ "type": "likert", "name": "likertscale", + "required": "true", "points":{ "p1":{ "value":"1", @@ -41,7 +42,13 @@ "text":"I like it a lot" } } - } + }, + "question2":{ + "type": "textinput", + "name": "text_feedback", + "required": "false", + "size": "250" + } }, "database_table" :{ "table_name": "default_block3_test", @@ -49,6 +56,11 @@ "likertscale":{ "type": "integer", "nullable": "false" + }, + "text_feedback":{ + "type": "string", + "size": "250", + "nullable": "true" } } } diff --git a/slaeforms/templates/standard_template.html b/slaeforms/templates/standard_template.html index 17ea526..fbf7dcc 100644 --- a/slaeforms/templates/standard_template.html +++ b/slaeforms/templates/standard_template.html @@ -16,6 +16,12 @@ {% endif %} {%- endmacro %} +{% macro required(question) -%} +{% if (question["required"] == "true") %} +required +{% endif %} +{%- endmacro %} + {% macro input(name, value='', type='text', size=20) -%} @@ -47,12 +53,14 @@
{% for point in questions[question]["points"] %} - + {% endfor %}
{% elif (questions[question]["type"] == "textinput") %} + + {% else %}

Error: Block {{config["question 1"]["blocks"][block]["type"]}} could not be loaded!

{% endif %}