manage.get.gov/src/registrar/templates/django/forms/widgets/multiple_input.html
zandercymatics bc3a96aa87
fine comb
2024-12-10 13:50:30 -07:00

32 lines
No EOL
1.3 KiB
HTML

{% load static custom_filters %}
<div class="{{ uswds_input_class }}">
{% for group, options, index in widget.optgroups %}
{% if group %}<div><label>{{ group }}</label>{% endif %}
{% for option in options %}
<input
type="{{ option.type }}"
name="{{ option.name }}"
{# hint: spacing in the class string matters #}
class="{{ uswds_input_class }}__input {% if classes %} {{ classes }}{% endif %}"
{% if option.value != None %}value="{{ option.value|stringformat:'s' }}"{% endif %}
{% include "django/forms/widgets/attrs.html" with widget=option %}
/>
<label
class="{{ uswds_input_class }}__label{% if label_classes %} {{ label_classes }}{% endif %}"
for="{{ option.attrs.id }}"
>
{{ option.label }}
{% comment %} Add a description on each, if available {% endcomment %}
{% if field and field.field and field.field.descriptions %}
{% with description=field.field.descriptions|get_dict_value:option.value %}
{% if description %}
<p class="margin-0 margin-top-1">{{ description }}</p>
{% endif %}
{% endwith %}
{% endif %}
</label>
{% endfor %}
{% if group %}</div>{% endif %}
{% endfor %}
</div>