updated behavior of combobox, added state territory combobox

This commit is contained in:
David Kennedy 2025-01-10 06:50:36 -05:00
parent 560baed2e1
commit bb5f61fd98
No known key found for this signature in database
GPG key ID: 6528A5386E66B96B
2 changed files with 2 additions and 0 deletions

View file

@ -57,6 +57,7 @@ class RequestingEntityForm(RegistrarForm):
label="State, territory, or military post",
required=False,
choices=[("", "--Select--")] + DomainRequest.StateTerritoryChoices.choices,
widget=ComboboxWidget,
)
def __init__(self, *args, **kwargs):

View file

@ -3,6 +3,7 @@
{# hint: spacing in the class string matters #}
class="usa-select{% if classes %} {{ classes }}{% endif %}"
{% include "django/forms/widgets/attrs.html" %}
data-default-value="{% for group_name, group_choices, group_index in widget.optgroups %}{% for option in group_choices %}{% if option.selected %}{{ option.value }}{% endif %}{% endfor %}{% endfor %}"
>
{% for group, options, index in widget.optgroups %}
{% if group %}<optgroup label="{{ group }}">{% endif %}