diff --git a/src/registrar/forms/application_wizard.py b/src/registrar/forms/application_wizard.py index e55b595fb..3dcb30df2 100644 --- a/src/registrar/forms/application_wizard.py +++ b/src/registrar/forms/application_wizard.py @@ -101,9 +101,10 @@ class OrganizationContactForm(RegistrarForm): federal_agency = forms.ChoiceField( label="Federal agency", # not required because this field won't be filled out unless - # it is a federal agency. + # it is a federal agency. Use clean to check programatically + # if it has been filled in when required. required=False, - choices=DomainApplication.AGENCY_CHOICES, + choices=[("", "--Select--")] + DomainApplication.AGENCY_CHOICES, label_suffix=REQUIRED_SUFFIX, ) organization_name = forms.CharField( @@ -138,6 +139,18 @@ class OrganizationContactForm(RegistrarForm): label="Urbanization (Puerto Rico only)", ) + def clean_federal_agency(self): + """Require something to be selected when this is a federal agency.""" + federal_agency = self.cleaned_data.get("federal_agency", None) + # need the wizard object to know if this is federal + context = self.get_context() + print(context) + if wizard._is_federal(): + if not federal_agency: + # no answer was selected + raise forms.ValidationError("Please select your federal agency.", code="required") + return federal_agency + class AuthorizingOfficialForm(RegistrarForm): def to_database(self, obj): diff --git a/src/registrar/templates/application_dotgov_domain.html b/src/registrar/templates/application_dotgov_domain.html index 752232543..70582a8b7 100644 --- a/src/registrar/templates/application_dotgov_domain.html +++ b/src/registrar/templates/application_dotgov_domain.html @@ -21,16 +21,16 @@ {% include "includes/domain_example__city.html" %} -
+

What .gov domain do you want?

After you enter your domain, we’ll make sure it’s available and that it meets some of our naming requirements. If your domain passes these initial checks, we’ll verify that it meets all of our requirements once you complete and submit the rest of this form.

+

This question is required.

{{ wizard.management_form }} {% csrf_token %} {% if wizard.form.requested_domain.errors %}
- {{ wizard.form.requested_domain|add_label_class:"usa-label usa-label--error" }} {% for error in wizard.form.requested_domain.errors %} {{ error }} @@ -43,7 +43,6 @@
{% else %} - {{ wizard.form.requested_domain|add_label_class:"usa-label" }}
www. {{ wizard.form.requested_domain|add_class:"usa-input"|attr:"aria-describedby:domain_instructions" }} diff --git a/src/registrar/templates/application_org_federal.html b/src/registrar/templates/application_org_federal.html index 6640e43f0..6d9b0a2c1 100644 --- a/src/registrar/templates/application_org_federal.html +++ b/src/registrar/templates/application_org_federal.html @@ -10,7 +10,8 @@ {% csrf_token %}
-

Which federal branch is your organization in?

+

Which federal branch is your organization in?

+

This question is required.

{% radio_buttons_by_value wizard.form.federal_type as choices %} {% for choice in choices.values %} diff --git a/src/registrar/templates/application_purpose.html b/src/registrar/templates/application_purpose.html index 8dd2d2ab3..b03228a07 100644 --- a/src/registrar/templates/application_purpose.html +++ b/src/registrar/templates/application_purpose.html @@ -8,14 +8,30 @@

Describe the reason for your domain request. Explain how you plan to use this domain. Will you use it for a website and/or email? Are you moving your website from another top-level domain (like .com or .org)? Read about activities that are prohibited on .gov domains.

+

This question is required.

+
{{ wizard.management_form }} {% csrf_token %}
- {{ wizard.form.purpose|add_label_class:"usa-label usa-sr-only" }} - {{ wizard.form.purpose|add_class:"usa-textarea usa-character-count__field"|attr:"aria-describedby:instructions"|attr:"maxlength=500" }} + {% with field=wizard.form.purpose %} + {% if field.errors %} +
+ {{ field|add_label_class:"usa-label usa-label--error usa-sr-only" }} + {% for error in field.errors %} + + {{ error }} + + {% endfor %} + {{ field|add_class:"usa-input--error usa-textarea usa-character-count__field"|attr:"aria-describedby:instructions"|attr:"maxlength=500"|attr:"aria-invalid:true" }} +
+ {% else %} + {{ field|add_label_class:"usa-label usa-sr-only" }} + {{ field|add_class:"usa-textarea usa-character-count__field"|attr:"aria-describedby:instructions"|attr:"maxlength=500" }} + {% endif %} + {% endwith %} You can enter up to 500 characters
diff --git a/src/registrar/templates/application_requirements.html b/src/registrar/templates/application_requirements.html index 26a905b4b..4c91d99ae 100644 --- a/src/registrar/templates/application_requirements.html +++ b/src/registrar/templates/application_requirements.html @@ -127,6 +127,8 @@

Acknowledgement of .gov domain requirements

+

This question is required.

+
{{ wizard.management_form }}