Skip to content

Commit 546ea89

Browse files
author
Kal Walkden
committed
Implement radio button form element
1 parent b790154 commit 546ea89

File tree

1 file changed

+14
-23
lines changed
  • materializecssform/templates/materializecssform

1 file changed

+14
-23
lines changed

materializecssform/templates/materializecssform/field.html

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,22 @@
2525
</div>
2626
{% elif field|is_radio %}
2727
<div class="col {{ classes.label }}">
28+
<div class="{{ classes.single_value }} {% if field.field.required and form.required_css_class %}{{ form.required_css_class }}{% endif %}">
29+
<label>
30+
{% if field.auto_id %}
31+
{{ field }}
32+
<span>{{ field.label }}</span>
33+
{% endif %}
34+
{% for error in field.errors %}
35+
<span class="help-block {{ form.error_css_class }}">{{ error }}</span>
36+
{% endfor %}
2837

29-
{% comment %}
30-
TODO: Make look like checked box
31-
{% endcomment %}
32-
{{ field }}
33-
34-
{% if field.auto_id %}
35-
<label class="control-label {{ classes.label }} {% if field.field.required %}{{ form.required_css_class }}{% endif %}">{{ field.label }}</label>
36-
{% endif %}
37-
<div class="{{ classes.value }}">
38-
{% for choice in field %}
39-
<p>
40-
{{ choice.tag }}
41-
<label for="{{ choice.id_for_label }}">{{ choice.choice_label }}</label>
42-
</p>
43-
{% endfor %}
44-
45-
{% for error in field.errors %}
46-
<span class="help-block {{ form.error_css_class }}">{{ error }}</span>
47-
{% endfor %}
48-
38+
</div>
39+
</label>
4940
{% if field.help_text %}
50-
<p class="help-block">
51-
{{ field.help_text|safe }}
52-
</p>
41+
<p class="help-block">
42+
{{ field.help_text|safe }}
43+
</p>
5344
{% endif %}
5445
</div>
5546
</div>

0 commit comments

Comments
 (0)