From bb3ceb4dea34eb55328e63897cc6223ff4a47630 Mon Sep 17 00:00:00 2001 From: David Kennedy Date: Wed, 2 Oct 2024 19:11:12 -0400 Subject: [PATCH 1/4] updated error messages --- src/registrar/forms/domain.py | 8 ++++---- src/registrar/forms/domain_request_wizard.py | 6 +++--- src/registrar/forms/portfolio.py | 3 ++- src/registrar/forms/user_profile.py | 2 +- src/registrar/templates/domain_org_name_address.html | 2 +- src/registrar/templates/domain_request_org_contact.html | 2 +- src/registrar/templates/portfolio_organization.html | 2 +- src/registrar/tests/test_forms.py | 2 +- src/registrar/utility/errors.py | 2 +- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/registrar/forms/domain.py b/src/registrar/forms/domain.py index 84fcbe973..3d79790ca 100644 --- a/src/registrar/forms/domain.py +++ b/src/registrar/forms/domain.py @@ -35,7 +35,7 @@ class DomainAddUserForm(forms.Form): email = forms.EmailField( label="Email", max_length=None, - error_messages={"invalid": ("Enter your email address in the required format, like name@example.com.")}, + error_messages={"invalid": ("Enter an email address in the required format, like name@example.com.")}, validators=[ MaxLengthValidator( 320, @@ -285,7 +285,7 @@ class UserForm(forms.ModelForm): "required": "Enter your title or role in your organization (e.g., Chief Information Officer)" } self.fields["email"].error_messages = { - "required": "Enter your email address in the required format, like name@example.com." + "required": "Enter an email address in the required format, like name@example.com." } self.fields["phone"].error_messages["required"] = "Enter your phone number." self.domainInfo = None @@ -342,7 +342,7 @@ class ContactForm(forms.ModelForm): "required": "Enter your title or role in your organization (e.g., Chief Information Officer)" } self.fields["email"].error_messages = { - "required": "Enter your email address in the required format, like name@example.com." + "required": "Enter an email address in the required format, like name@example.com." } self.fields["phone"].error_messages["required"] = "Enter your phone number." self.domainInfo = None @@ -458,7 +458,7 @@ class DomainOrgNameAddressForm(forms.ModelForm): validators=[ RegexValidator( "^[0-9]{5}(?:-[0-9]{4})?$|^$", - message="Enter a zip code in the required format, like 12345 or 12345-6789.", + message="Enter a 5-digit or 9-digit ZIP code, like 12345 or 12345-6789.", ) ], ) diff --git a/src/registrar/forms/domain_request_wizard.py b/src/registrar/forms/domain_request_wizard.py index f2fdd32bc..4fb2f9265 100644 --- a/src/registrar/forms/domain_request_wizard.py +++ b/src/registrar/forms/domain_request_wizard.py @@ -137,10 +137,10 @@ class OrganizationContactForm(RegistrarForm): validators=[ RegexValidator( "^[0-9]{5}(?:-[0-9]{4})?$|^$", - message="Enter a zip code in the form of 12345 or 12345-6789.", + message="Enter a 5-digit or 9-digit ZIP code, like 12345 or 12345-6789.", ) ], - error_messages={"required": ("Enter a zip code in the form of 12345 or 12345-6789.")}, + error_messages={"required": ("Enter a 5-digit or 9-digit ZIP code, like 12345 or 12345-6789.")}, ) urbanization = forms.CharField( required=False, @@ -603,7 +603,7 @@ class CisaRepresentativeForm(BaseDeletableRegistrarForm): max_length=None, required=False, error_messages={ - "invalid": ("Enter your representative’s email address in the required format, like name@example.com."), + "invalid": ("Enter an email address in the required format, like name@example.com."), }, validators=[ MaxLengthValidator( diff --git a/src/registrar/forms/portfolio.py b/src/registrar/forms/portfolio.py index 14a45f6ae..85bc51240 100644 --- a/src/registrar/forms/portfolio.py +++ b/src/registrar/forms/portfolio.py @@ -17,7 +17,7 @@ class PortfolioOrgAddressForm(forms.ModelForm): validators=[ RegexValidator( "^[0-9]{5}(?:-[0-9]{4})?$|^$", - message="Enter a zip code in the required format, like 12345 or 12345-6789.", + message="Enter a 5-digit or 9-digit ZIP code, like 12345 or 12345-6789.", ) ], ) @@ -38,6 +38,7 @@ class PortfolioOrgAddressForm(forms.ModelForm): "state_territory": { "required": "Select the state, territory, or military post where your organization is located." }, + "zipcode": {"required": "Enter a 5-digit or 9-digit ZIP code, like 12345 or 12345-6789."}, } widgets = { # We need to set the required attributed for State/territory diff --git a/src/registrar/forms/user_profile.py b/src/registrar/forms/user_profile.py index 2a6ed4a47..8d8e2973d 100644 --- a/src/registrar/forms/user_profile.py +++ b/src/registrar/forms/user_profile.py @@ -58,7 +58,7 @@ class UserProfileForm(forms.ModelForm): "required": "Enter your title or role in your organization (e.g., Chief Information Officer)" } self.fields["email"].error_messages = { - "required": "Enter your email address in the required format, like name@example.com." + "required": "Enter an email address in the required format, like name@example.com." } self.fields["phone"].error_messages["required"] = "Enter your phone number." diff --git a/src/registrar/templates/domain_org_name_address.html b/src/registrar/templates/domain_org_name_address.html index 78baed09e..f7f6b558b 100644 --- a/src/registrar/templates/domain_org_name_address.html +++ b/src/registrar/templates/domain_org_name_address.html @@ -42,7 +42,7 @@ {% input_with_errors form.state_territory %} - {% with add_class="usa-input--small" sublabel_text="Enter a zip code in the required format, like 12345 or 12345-6789." %} + {% with add_class="usa-input--small" sublabel_text="Enter a 5-digit or 9-digit ZIP code, like 12345 or 12345-6789." %} {% input_with_errors form.zipcode %} {% endwith %} diff --git a/src/registrar/templates/domain_request_org_contact.html b/src/registrar/templates/domain_request_org_contact.html index d4f3c2071..72c6e4b6d 100644 --- a/src/registrar/templates/domain_request_org_contact.html +++ b/src/registrar/templates/domain_request_org_contact.html @@ -33,7 +33,7 @@ {% input_with_errors forms.0.state_territory %} - {% with add_class="usa-input--small" sublabel_text="Enter a zip code in the required format, like 12345 or 12345-6789." %} + {% with add_class="usa-input--small" sublabel_text="Enter a 5-digit or 9-digit ZIP code, like 12345 or 12345-6789." %} {% input_with_errors forms.0.zipcode %} {% endwith %} diff --git a/src/registrar/templates/portfolio_organization.html b/src/registrar/templates/portfolio_organization.html index 2e6a1f488..1c59ae726 100644 --- a/src/registrar/templates/portfolio_organization.html +++ b/src/registrar/templates/portfolio_organization.html @@ -45,7 +45,7 @@ {% input_with_errors form.address_line2 %} {% input_with_errors form.city %} {% input_with_errors form.state_territory %} - {% with add_class="usa-input--small" sublabel_text="Enter a zip code in the required format, like 12345 or 12345-6789." %} + {% with add_class="usa-input--small" sublabel_text="Enter a 5-digit or 9-digit ZIP code, like 12345 or 12345-6789." %} {% input_with_errors form.zipcode %} {% endwith %}