mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-05 07:18:25 -04:00
adding error annoucement
This commit is contained in:
@@ -645,6 +645,7 @@ def edit_service_template(service_id, template_id):
|
|||||||
return render_template(
|
return render_template(
|
||||||
"views/edit-{}-template.html".format(template["template_type"]),
|
"views/edit-{}-template.html".format(template["template_type"]),
|
||||||
form=form,
|
form=form,
|
||||||
|
errors=form.errors if form.errors else None,
|
||||||
template=template,
|
template=template,
|
||||||
heading_action="Edit",
|
heading_action="Edit",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
{#- a record of other elements that we need to associate with the input using
|
{#- a record of other elements that we need to associate with the input using
|
||||||
aria-describedby – for example hints or error messages -#}
|
aria-describedby – for example hints or error messages -#}
|
||||||
{% set describedBy = params.describedBy if params.describedBy else "" %}
|
{% set describedBy = params.describedBy if params.describedBy else "" %}
|
||||||
<div class="usa-form-group {%- if params.errorMessage %} usa-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
|
<div class="usa-form-group {%- if params.errorMessage %} usa-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}" aria-live="polite" role="alert">
|
||||||
{{ usaLabel({
|
{{ usaLabel({
|
||||||
html: params.label.html,
|
html: params.label.html,
|
||||||
text: params.label.text,
|
text: params.label.text,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
) %}
|
) %}
|
||||||
<div
|
<div
|
||||||
class="usa-form-group{% if field.errors %} usa-form-group--error{% endif %} {{ extra_form_group_classes }}"
|
class="usa-form-group{% if field.errors %} usa-form-group--error{% endif %} {{ extra_form_group_classes }}"
|
||||||
data-module="{% if autofocus %}autofocus{% elif colour_preview %}colour-preview{% endif %}"
|
data-module="{% if autofocus %}autofocus{% elif colour_preview %}colour-preview{% endif %}" aria-live="polite" role="alert"
|
||||||
>
|
>
|
||||||
<label class="usa-label" for="{{ field.name }}">
|
<label class="usa-label" for="{{ field.name }}">
|
||||||
{% if label %}
|
{% if label %}
|
||||||
@@ -32,11 +32,11 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if field.errors %}
|
{% if field.errors %}
|
||||||
<span class="usa-error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
|
<span id="{{ field.name}}-error" class="usa-error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
|
||||||
|
<span class="usa-sr-only">Error:</span>
|
||||||
{% if not safe_error_message %}{{ field.errors[0] }}{% else %}{{ field.errors[0]|safe }}{% endif %}
|
{% if not safe_error_message %}{{ field.errors[0] }}{% else %}{{ field.errors[0]|safe }}{% endif %}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%
|
{%
|
||||||
if highlight_placeholders or autosize
|
if highlight_placeholders or autosize
|
||||||
%}
|
%}
|
||||||
@@ -55,6 +55,7 @@
|
|||||||
data_highlight_placeholders='true' if highlight_placeholders else 'false',
|
data_highlight_placeholders='true' if highlight_placeholders else 'false',
|
||||||
rows=rows|string,
|
rows=rows|string,
|
||||||
placeholder=placeholder,
|
placeholder=placeholder,
|
||||||
|
aria_describedby=field.name+"-error",
|
||||||
**kwargs
|
**kwargs
|
||||||
) }}
|
) }}
|
||||||
{% if suffix %}
|
{% if suffix %}
|
||||||
|
|||||||
@@ -15,6 +15,19 @@
|
|||||||
}) }}
|
}) }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block skipLink %}
|
||||||
|
{% set skipLink = usaSkipLink({
|
||||||
|
"href": '#main-content',
|
||||||
|
"text": 'Skip to main content'
|
||||||
|
}) %}
|
||||||
|
{% if errors %}
|
||||||
|
<div>{{ skipLink }}</div>
|
||||||
|
{% else %}
|
||||||
|
{{ skipLink }}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block maincolumn_content %}
|
{% block maincolumn_content %}
|
||||||
|
|
||||||
{{ page_header('{} text message template'.format(heading_action)) }}
|
{{ page_header('{} text message template'.format(heading_action)) }}
|
||||||
|
|||||||
Reference in New Issue
Block a user