Skip to content

Commit

Permalink
Merge pull request #449 from cisagov/jon/448
Browse files Browse the repository at this point in the history
Caution Box removed.
  • Loading branch information
kewlguy781 authored Mar 6, 2023
2 parents 22eb49c + 42ed6d3 commit 4202775
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
14 changes: 9 additions & 5 deletions src/registrar/templates/includes/form_errors.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{% comment %}
This only shows non-field errors at the top of form pages.
The individual field errors are not shown at the top of the
page, they are shown on each individual field.
{% endcomment %}
{% if form.errors %}
{% for error in form.non_field_errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
Expand All @@ -11,4 +6,13 @@
</div>
</div>
{% endfor %}
{% for field in form %}
{% for error in field.errors %}
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
<div class="usa-alert__body">
{{ error|escape }}
</div>
</div>
{% endfor %}
{% endfor %}
{% endif %}
14 changes: 0 additions & 14 deletions src/registrar/views/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView
from django.contrib import messages
from django.utils.safestring import mark_safe

from registrar.forms import application_wizard as forms
from registrar.models import DomainApplication
Expand Down Expand Up @@ -321,19 +320,6 @@ def post(self, request, *args, **kwargs) -> HttpResponse:
# always save progress
self.save(forms)
else:
# unless there are errors
# no sec because this use of mark_safe does not introduce a cross-site
# scripting vulnerability because there is no untrusted content inside.
# It is only being used to pass a specific HTML entity into a template.
messages.warning(
request,
mark_safe( # nosec
"<b>We could not save all the fields.</b><br/> The highlighted "
+ "fields below <b>could not be saved</b> because they have "
+ "missing or invalid data. All other information on this page "
+ "has been saved."
),
)
context = self.get_context_data()
context["forms"] = forms
return render(request, self.template_name, context)
Expand Down

0 comments on commit 4202775

Please sign in to comment.