field.html
2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
{% macro field(title,type,placeholder="",options=[],required=False) %}
<div class="Field">
<div class="FieldTitle">
{{ title|title }}
{% if required %} <span class="Required">*</span> {% endif %}
</div>
<div class="FieldInput">
{% if type == "select" %}
<select onchange="Otro(this)" {% if required %} required {% endif %}>
<option selected disabled hidden value="">{{ placeholder }}</option>
{% for option in options %}
{% if option == "#other" %}
<option value="Otro">Otro</option>
{% else %}
<option value="{{ option }}">{{ option }}</option>
{% endif %}
{% endfor %}
</select>
<input type="text" class="Other">
{% elif type == "checkbox" %}
{% if options|length == 0 %}
<input type="checkbox" {% if required %} required {% endif %}>
{% endif %}
{% for option in options %}
{% if option == "#other" %}
<div class="Checkbox">
<div class="CheckboxTitle">
Otro
</div>
<div>
<input type="checkbox" onclick="Otro(this)" {% if required %} required {% endif %}>
</div>
</div>
{% else %}
<div class="Checkbox">
<div class="CheckboxTitle">
{{ option|title }}
</div>
<div>
<input type="checkbox" {% if required %} required {% endif %}>
</div>
</div>
{% endif %}
{% endfor %}
<input type="text" class="Other">
{% else %}
<input type="{{ type }}" placeholder="{{ placeholder }}" {% if required %} required {% endif %}>
{% endif %}
</div>
</div>
<hr class="Separator">
{% endmacro %}