PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 2ms app.codeStats 0ms

/modules/mod_survey/templates/_survey_question_narrative.tpl

https://code.google.com/p/zotonic/
Smarty Template | 21 lines | 21 code | 0 blank | 0 comment | 15 complexity | 1aac23f482005e812ca2bcaf5508ecd4 MD5 | raw file
 1<p>
 2	{% for type,name,value in question.parts %}
 3	{% with forloop.counter, answers[name] as index, ans %}
 4		{% if type == "html" %}
 5			{{ value }}
 6		{% endif %}
 7		{% if type == "input" %}
 8			<input id="{{ #inp.index }}" name="{{ name }}" length="{{ value }}" style="width: {{ value }}em" value="{{ ans|escape }}" />
 9    {% if question.is_required %}{% validate id=#inp.index name=name type={presence} %}{% endif %}
10		{% endif %}
11		{% if type == "select" %}
12			<select id="{{ #sel.index }}" name="{{ name }}">
13				{% for p in value %}
14					<option {% if p == "" %}disabled="disabled"{% else %}{% if ans == p %}selected="selected"{% endif %}{% endif %}>{{ p|escape }}</option>
15				{% endfor %}
16			</select>
17    {% if question.is_required %}{% validate id=#sel.index name=name type={presence} %}{% endif %}
18		{% endif %}
19	{% endwith %}
20	{% endfor %}
21</p>