mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-19 01:44:45 -05:00
Problems: - WTForms expects the value of checkboxes to always be `y` (they don’t work like radio buttons, which is where I copied this code for) - WTForms `BooleanField`s don’t have a checked attribute, they set their data attibute to `True` or `False`
23 lines
446 B
HTML
23 lines
446 B
HTML
{% macro checkbox(
|
|
field,
|
|
hint=False,
|
|
width='2-3'
|
|
) %}
|
|
<div class="multiple-choice">
|
|
<input
|
|
id="{{ field.id }}" name="{{ field.name }}" type="checkbox" value="y"
|
|
{% if field.data %}
|
|
checked
|
|
{% endif %}
|
|
>
|
|
<label for="{{ field.id }}">
|
|
{{ field.label.text }}
|
|
{% if hint %}
|
|
<div class="hint">
|
|
{{ hint }}
|
|
</div>
|
|
{% endif %}
|
|
</label>
|
|
</div>
|
|
{% endmacro %}
|