mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-27 13:51:12 -05:00
It’s invalid HTML to have multiple labels nested within each other. This
was happening by accident because WTForms tries to be clever – when you
put `{{ field.label }}` in a template it prints a `<label>` tag for you,
not just the text of the label. But we put our own `<label>` tags in the
HTML to have more control of them.
This commit stops WTForms being so clever.
30 lines
759 B
HTML
30 lines
759 B
HTML
{% macro checkbox(
|
|
field,
|
|
hint=False,
|
|
help_link=None,
|
|
help_link_text=None,
|
|
width='2-3',
|
|
suffix=None,
|
|
block=False
|
|
) %}
|
|
<label class="{% if block %}block-label{% endif %}" for="{{ field.name }}">
|
|
{{ field()}}
|
|
{{ field.label.text }}
|
|
{% if hint %}
|
|
<span class="form-hint">
|
|
{{ hint }}
|
|
</span>
|
|
{% endif %}
|
|
{% if field.errors %}
|
|
<span class="error-message">
|
|
{{ field.errors[0] }}
|
|
</span>
|
|
{% endif %}
|
|
{% if help_link and help_link_text %}
|
|
<p class="textbox-help-link">
|
|
<a href='{{ help_link }}'>{{ help_link_text }}</a>
|
|
</p>
|
|
{% endif %}
|
|
</label>
|
|
{% endmacro %}
|