mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-11 20:19:38 +02:00
Edit to show error instead of caution
This commit is contained in:
parent
22eb49c004
commit
b64f37efea
2 changed files with 9 additions and 18 deletions
|
@ -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 %}
|
{% if form.errors %}
|
||||||
{% for error in form.non_field_errors %}
|
{% for error in form.non_field_errors %}
|
||||||
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
|
<div class="usa-alert usa-alert--error usa-alert--slim margin-bottom-2">
|
||||||
|
@ -11,4 +6,13 @@ page, they are shown on each individual field.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|
|
@ -321,19 +321,6 @@ class ApplicationWizard(LoginRequiredMixin, TemplateView):
|
||||||
# always save progress
|
# always save progress
|
||||||
self.save(forms)
|
self.save(forms)
|
||||||
else:
|
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 = self.get_context_data()
|
||||||
context["forms"] = forms
|
context["forms"] = forms
|
||||||
return render(request, self.template_name, context)
|
return render(request, self.template_name, context)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue