Added Text Input and "required" html tag
This commit is contained in:
parent
1b1b37d108
commit
71590b425b
@ -19,6 +19,7 @@
|
|||||||
"question1":{
|
"question1":{
|
||||||
"type": "likert",
|
"type": "likert",
|
||||||
"name": "likertscale",
|
"name": "likertscale",
|
||||||
|
"required": "true",
|
||||||
"points":{
|
"points":{
|
||||||
"p1":{
|
"p1":{
|
||||||
"value":"1",
|
"value":"1",
|
||||||
@ -41,7 +42,13 @@
|
|||||||
"text":"I like it a lot"
|
"text":"I like it a lot"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"question2":{
|
||||||
|
"type": "textinput",
|
||||||
|
"name": "text_feedback",
|
||||||
|
"required": "false",
|
||||||
|
"size": "250"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"database_table" :{
|
"database_table" :{
|
||||||
"table_name": "default_block3_test",
|
"table_name": "default_block3_test",
|
||||||
@ -49,6 +56,11 @@
|
|||||||
"likertscale":{
|
"likertscale":{
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"nullable": "false"
|
"nullable": "false"
|
||||||
|
},
|
||||||
|
"text_feedback":{
|
||||||
|
"type": "string",
|
||||||
|
"size": "250",
|
||||||
|
"nullable": "true"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,12 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{%- endmacro %}
|
{%- endmacro %}
|
||||||
|
|
||||||
|
{% macro required(question) -%}
|
||||||
|
{% if (question["required"] == "true") %}
|
||||||
|
required
|
||||||
|
{% endif %}
|
||||||
|
{%- endmacro %}
|
||||||
|
|
||||||
{% macro input(name, value='', type='text', size=20) -%}
|
{% macro input(name, value='', type='text', size=20) -%}
|
||||||
<input type="{{ type }}" name="{{ name }}" value="{{
|
<input type="{{ type }}" name="{{ name }}" value="{{
|
||||||
value|e }}" size="{{ size }}">
|
value|e }}" size="{{ size }}">
|
||||||
@ -47,12 +53,14 @@
|
|||||||
<div class="likercontainer">
|
<div class="likercontainer">
|
||||||
<div class="likert">
|
<div class="likert">
|
||||||
{% for point in questions[question]["points"] %}
|
{% 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 %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% elif (questions[question]["type"] == "textinput") %}
|
{% 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 %}
|
{% else %}
|
||||||
<p>Error: Block {{config["question 1"]["blocks"][block]["type"]}} could not be loaded!</p>
|
<p>Error: Block {{config["question 1"]["blocks"][block]["type"]}} could not be loaded!</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user