mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-30 04:53:09 +02:00
78 lines
1.9 KiB
HTML
78 lines
1.9 KiB
HTML
{% comment %}
|
|
Template include for form fields with classes and their corresponding
|
|
error messages, if necessary.
|
|
{% endcomment %}
|
|
|
|
{% load widget_tweaks %}
|
|
|
|
{% if widget.attrs.maxlength %}
|
|
<div class="usa-character-count">
|
|
{% endif %}
|
|
|
|
{% if field.use_fieldset %}
|
|
<fieldset
|
|
id="{{ widget.attrs.id }}__fieldset"
|
|
class="usa-fieldset usa-form-group{% if group_classes %} {{ group_classes }}{% endif %}"
|
|
>
|
|
{% elif field.widget_type == 'checkbox' %}
|
|
<div
|
|
class="usa-checkbox{% if group_classes %} {{ group_classes }}{% endif %}"
|
|
>
|
|
{% else %}
|
|
<div
|
|
class="usa-form-group{% if group_classes %} {{ group_classes }}{% endif %}"
|
|
>
|
|
{% endif %}
|
|
|
|
{% if not field.widget_type == "checkbox" %}
|
|
{% include "django/forms/label.html" %}
|
|
{% endif %}
|
|
|
|
{% if sublabel_text %}
|
|
<p id="{{ widget.attrs.id }}__sublabel" class="text-base margin-top-2px margin-bottom-1">{{ sublabel_text }}</p>
|
|
{% endif %}
|
|
|
|
{% if field.errors %}
|
|
<div id="{{ widget.attrs.id }}__error-message">
|
|
{% for error in field.errors %}
|
|
<span class="usa-error-message" role="alert">
|
|
{{ error }}
|
|
</span>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if www_gov %}
|
|
<div class="display-flex flex-align-center">
|
|
<span class="padding-top-05 padding-right-2px">www.</span>
|
|
{% endif %}
|
|
|
|
{# this is the input field, itself #}
|
|
{% include widget.template_name %}
|
|
|
|
{% if www_gov %}
|
|
<span class="padding-top-05 padding-left-2px">.gov </span>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if field.widget_type == "checkbox" %}
|
|
{% include "django/forms/label.html" %}
|
|
{% endif %}
|
|
|
|
{% if field.use_fieldset %}
|
|
</fieldset>
|
|
{% else %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if widget.attrs.maxlength %}
|
|
<span
|
|
id="{{ widget.attrs.id }}__message"
|
|
class="usa-character-count__message"
|
|
aria-live="polite"
|
|
>
|
|
You can enter up to {{ widget.attrs.maxlength }} characters
|
|
</span>
|
|
|
|
</div>
|
|
{% endif %}
|