Added Text Input and "required" html tag
This commit is contained in:
parent
1b1b37d108
commit
71590b425b
@ -19,6 +19,7 @@
|
||||
"question1":{
|
||||
"type": "likert",
|
||||
"name": "likertscale",
|
||||
"required": "true",
|
||||
"points":{
|
||||
"p1":{
|
||||
"value":"1",
|
||||
@ -41,6 +42,12 @@
|
||||
"text":"I like it a lot"
|
||||
}
|
||||
}
|
||||
},
|
||||
"question2":{
|
||||
"type": "textinput",
|
||||
"name": "text_feedback",
|
||||
"required": "false",
|
||||
"size": "250"
|
||||
}
|
||||
},
|
||||
"database_table" :{
|
||||
@ -49,6 +56,11 @@
|
||||
"likertscale":{
|
||||
"type": "integer",
|
||||
"nullable": "false"
|
||||
},
|
||||
"text_feedback":{
|
||||
"type": "string",
|
||||
"size": "250",
|
||||
"nullable": "true"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 %}
|
||||
|
Loading…
Reference in New Issue
Block a user