From 44e89f46bb89bc27046b6c2eba7f7771ab3a3017 Mon Sep 17 00:00:00 2001 From: CocoByte Date: Fri, 28 Mar 2025 11:30:22 -0600 Subject: [PATCH] Fixes for Additional Details radio button ANDI outputs --- src/registrar/forms/utility/wizard_form_helper.py | 3 +++ ...ortfolio_domain_request_additional_details.html | 14 +++++--------- src/registrar/templatetags/field_helpers.py | 4 ++++ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/registrar/forms/utility/wizard_form_helper.py b/src/registrar/forms/utility/wizard_form_helper.py index eedf5839b..4245bed30 100644 --- a/src/registrar/forms/utility/wizard_form_helper.py +++ b/src/registrar/forms/utility/wizard_form_helper.py @@ -234,9 +234,12 @@ class BaseYesNoForm(RegistrarForm): # For instance, this could be "has_other_contacts" field_name: str + # This field can be overriden to show a custom error + # message. required_error_message = "This question is required." # Default form choice mapping. Default is suitable for most cases. + # Override for more complex scenarios. form_choices = ((True, "Yes"), (False, "No")) def __init__(self, *args, **kwargs): diff --git a/src/registrar/templates/portfolio_domain_request_additional_details.html b/src/registrar/templates/portfolio_domain_request_additional_details.html index 527b59969..9f005692e 100644 --- a/src/registrar/templates/portfolio_domain_request_additional_details.html +++ b/src/registrar/templates/portfolio_domain_request_additional_details.html @@ -11,14 +11,12 @@
{{forms.0.management_form}} {{forms.1.management_form}} - -

Are you working with someone in the Executive Office of the President (EOP) on this request?

-
-

Working with the EOP is not required to request a .gov domain.

+

Are you working with someone in the Executive Office of the President (EOP) on this request?

+

Working with the EOP is not required to request a .gov domain.

Select one. *

- {% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %} + {% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" add_aria_describedby="working-with-eop--requirement" add_legend_heading="Are you working with someone in the Executive Office of the President (EOP) on this request?" %} {% input_with_errors forms.0.working_with_eop %} {% endwith %} @@ -36,13 +34,11 @@
{{forms.2.management_form}} {{forms.3.management_form}} - -

Is there anything else you'd like us to know about your domain request?

-
+

Is there anything else you'd like us to know about your domain request?

Select one. *

- {% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" %} + {% with add_class="usa-radio__input--tile" add_legend_class="usa-sr-only" add_legend_heading="Is there anything else you'd like us to know about your domain request?"%} {% input_with_errors forms.2.has_anything_else_text %} {% endwith %} diff --git a/src/registrar/templatetags/field_helpers.py b/src/registrar/templatetags/field_helpers.py index 69d3f228e..ddf34211f 100644 --- a/src/registrar/templatetags/field_helpers.py +++ b/src/registrar/templatetags/field_helpers.py @@ -23,8 +23,10 @@ def input_with_errors(context, field=None): # noqa: C901 add_required_class: like `add_class` but only if field is required add_label_class: append to input element's label's `class` attribute add_legend_class: append to input element's legend's `class` attribute + add_legend_heading: sets the text for the legend associated with this element add_group_class: append to input element's surrounding tag's `class` attribute add_aria_label: append to input element's `aria_label` attribute + add_aria_describedby: appends to input element's `aria-describedby` attribute attr_* - adds or replaces any single html attribute for the input add_error_attr_* - like `attr_*` but only if field.errors is not empty toggleable_input: shows a simple edit button, and adds display-none to the input field. @@ -106,6 +108,8 @@ def input_with_errors(context, field=None): # noqa: C901 elif key == "add_aria_label": aria_labels.append(value) + elif key == "add_aria_describedby": + described_by.append(value) elif key == "sublabel_text": sublabel_text.append(value)