mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-06-09 14:04:44 +02:00
Fix validation on character count, increase charater count to 1000 on textareas, increase textarea height on desktop
This commit is contained in:
parent
9183166866
commit
d8df2877f4
5 changed files with 34 additions and 4 deletions
|
@ -422,3 +422,9 @@ abbr[title] {
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.usa-textarea {
|
||||||
|
@include at-media('tablet') {
|
||||||
|
height: 20rem;
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,7 +5,7 @@ from typing import Callable
|
||||||
from phonenumber_field.formfields import PhoneNumberField # type: ignore
|
from phonenumber_field.formfields import PhoneNumberField # type: ignore
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.validators import RegexValidator
|
from django.core.validators import RegexValidator, MaxLengthValidator
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
|
@ -315,6 +315,12 @@ class TypeOfWorkForm(RegistrarForm):
|
||||||
# label has to end in a space to get the label_suffix to show
|
# label has to end in a space to get the label_suffix to show
|
||||||
label="What type of work does your organization do? ",
|
label="What type of work does your organization do? ",
|
||||||
widget=forms.Textarea(),
|
widget=forms.Textarea(),
|
||||||
|
validators=[
|
||||||
|
MaxLengthValidator(
|
||||||
|
1000,
|
||||||
|
message="Response must be less than 1000 characters",
|
||||||
|
)
|
||||||
|
],
|
||||||
error_messages={"required": "Enter the type of work your organization does."},
|
error_messages={"required": "Enter the type of work your organization does."},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -327,6 +333,12 @@ class TypeOfWorkForm(RegistrarForm):
|
||||||
" support your claims. "
|
" support your claims. "
|
||||||
),
|
),
|
||||||
widget=forms.Textarea(),
|
widget=forms.Textarea(),
|
||||||
|
validators=[
|
||||||
|
MaxLengthValidator(
|
||||||
|
1000,
|
||||||
|
message="Response must be less than 1000 characters",
|
||||||
|
)
|
||||||
|
],
|
||||||
error_messages={
|
error_messages={
|
||||||
"required": (
|
"required": (
|
||||||
"Describe how your organization is independent of a state government."
|
"Describe how your organization is independent of a state government."
|
||||||
|
@ -554,6 +566,12 @@ class PurposeForm(RegistrarForm):
|
||||||
purpose = forms.CharField(
|
purpose = forms.CharField(
|
||||||
label="Purpose",
|
label="Purpose",
|
||||||
widget=forms.Textarea(),
|
widget=forms.Textarea(),
|
||||||
|
validators=[
|
||||||
|
MaxLengthValidator(
|
||||||
|
1000,
|
||||||
|
message="Response must be less than 1000 characters",
|
||||||
|
)
|
||||||
|
],
|
||||||
error_messages={
|
error_messages={
|
||||||
"required": "Describe how you'll use the .gov domain you’re requesting."
|
"required": "Describe how you'll use the .gov domain you’re requesting."
|
||||||
},
|
},
|
||||||
|
@ -696,6 +714,12 @@ class AnythingElseForm(RegistrarForm):
|
||||||
required=False,
|
required=False,
|
||||||
label="Anything else we should know?",
|
label="Anything else we should know?",
|
||||||
widget=forms.Textarea(),
|
widget=forms.Textarea(),
|
||||||
|
validators=[
|
||||||
|
MaxLengthValidator(
|
||||||
|
1000,
|
||||||
|
message="Response must be less than 1000 characters",
|
||||||
|
)
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
|
|
||||||
{% block form_fields %}
|
{% block form_fields %}
|
||||||
{% with add_label_class="usa-sr-only" attr_maxlength=500 %}
|
{% with add_label_class="usa-sr-only" attr_maxlength=1000 %}
|
||||||
{% input_with_errors forms.0.anything_else %}
|
{% input_with_errors forms.0.anything_else %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -19,7 +19,7 @@ Read about <a href="{% url 'todo' %}">activities that are prohibited on .gov dom
|
||||||
|
|
||||||
|
|
||||||
{% block form_fields %}
|
{% block form_fields %}
|
||||||
{% with attr_maxlength=500 add_label_class="usa-sr-only" %}
|
{% with attr_maxlength=1000 add_label_class="usa-sr-only" %}
|
||||||
{% input_with_errors forms.0.purpose %}
|
{% input_with_errors forms.0.purpose %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
{% block form_fields %}
|
{% block form_fields %}
|
||||||
{% with attr_maxlength=500 %}
|
{% with attr_maxlength=1000 %}
|
||||||
{% input_with_errors forms.0.type_of_work %}
|
{% input_with_errors forms.0.type_of_work %}
|
||||||
{% input_with_errors forms.0.more_organization_information %}
|
{% input_with_errors forms.0.more_organization_information %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue