mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-13 16:04:49 +02:00
Add updated error messages for domain mgmt contact info
This commit is contained in:
parent
e92b7dfd46
commit
cd6809c9f7
1 changed files with 12 additions and 14 deletions
|
@ -125,19 +125,6 @@ class ContactForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Contact
|
model = Contact
|
||||||
fields = ["first_name", "middle_name", "last_name", "title", "email", "phone"]
|
fields = ["first_name", "middle_name", "last_name", "title", "email", "phone"]
|
||||||
error_messages = {
|
|
||||||
"first_name": {"required": "Enter your first name / given name."},
|
|
||||||
"last_name": {"required": "Enter your last name / family name."},
|
|
||||||
"title": {
|
|
||||||
"required": "Enter your title or role in your organization (e.g., Chief Information Officer)."
|
|
||||||
},
|
|
||||||
"email": {
|
|
||||||
"required": "Enter your email address in the required format, like name@example.com."
|
|
||||||
},
|
|
||||||
"phone": {
|
|
||||||
"required": "Enter your phone number."
|
|
||||||
},
|
|
||||||
}
|
|
||||||
widgets = {
|
widgets = {
|
||||||
"first_name": forms.TextInput,
|
"first_name": forms.TextInput,
|
||||||
"middle_name": forms.TextInput,
|
"middle_name": forms.TextInput,
|
||||||
|
@ -161,11 +148,22 @@ class ContactForm(forms.ModelForm):
|
||||||
for field_name in self.required:
|
for field_name in self.required:
|
||||||
self.fields[field_name].required = True
|
self.fields[field_name].required = True
|
||||||
|
|
||||||
|
# Set custom error messages
|
||||||
|
self.fields["first_name"].error_messages = {'required': 'Enter your first name / given name.'}
|
||||||
|
self.fields["last_name"].error_messages = {'required': 'Enter your last name / family name.'}
|
||||||
|
self.fields["title"].error_messages = {
|
||||||
|
'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.'
|
||||||
|
}
|
||||||
|
self.fields["phone"].error_messages = {'required': 'Enter your phone number.'}
|
||||||
|
|
||||||
|
|
||||||
class DomainSecurityEmailForm(forms.Form):
|
class DomainSecurityEmailForm(forms.Form):
|
||||||
"""Form for adding or editing a security email to a domain."""
|
"""Form for adding or editing a security email to a domain."""
|
||||||
|
|
||||||
security_email = forms.EmailField(label="Security email", required=False)
|
security_email = forms.EmailField(label="Security email (optional)", required=False)
|
||||||
|
|
||||||
|
|
||||||
class DomainOrgNameAddressForm(forms.ModelForm):
|
class DomainOrgNameAddressForm(forms.ModelForm):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue