Skip to content

Commit 0543aa6

Browse files
committed
bug #26590 Make sure form errors is valid HTML (Nyholm)
This PR was merged into the 3.4 branch. Discussion ---------- Make sure form errors is valid HTML | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26461 | License | MIT | Doc PR | Using `<div>` and `<ul>` in a `<label>` is not valid HTML. This PR uses `<span>`s instead and some Bootstrap 4 classes to make it look just like before. Commits ------- 5dcaaadb5e Make sure form errors is valid HTML
2 parents 93337b3 + 682d118 commit 0543aa6

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,12 @@
267267

268268
{% block form_errors -%}
269269
{%- if errors|length > 0 -%}
270-
<div class="{% if form is not rootform %}invalid-feedback d-block{% else %}alert alert-danger{% endif %}">
271-
<ul class="list-unstyled mb-0">
272-
{%- for error in errors -%}
273-
<li><span class="initialism form-error-icon badge badge-danger">{{ 'Error'|trans({}, 'validators') }}</span> <span class="form-error-message">{{ error.message }}</span></li>
274-
{%- endfor -%}
275-
</ul>
276-
</div>
270+
<span class="{% if form is not rootform %}invalid-feedback d-block{% else %}alert alert-danger{% endif %}">
271+
{%- for error in errors -%}
272+
<span class="mb-0 d-block">
273+
<span class="initialism form-error-icon badge badge-danger">{{ 'Error'|trans({}, 'validators') }}</span> <span class="form-error-message">{{ error.message }}</span>
274+
</span>
275+
{%- endfor -%}
276+
</span>
277277
{%- endif %}
278278
{%- endblock form_errors %}

0 commit comments

Comments
 (0)