diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig
index 3cb52c8d18..2acd7086b0 100644
--- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig
+++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig
@@ -267,12 +267,12 @@
{% block form_errors -%}
{%- if errors|length > 0 -%}
-
+
+ {%- for error in errors -%}
+
+ {{ 'Error'|trans({}, 'validators') }} {{ error.message }}
+
+ {%- endfor -%}
+
{%- endif %}
{%- endblock form_errors %}
diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap4HorizontalLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap4HorizontalLayoutTest.php
index e8ede167b3..c906c6549a 100644
--- a/src/Symfony/Component/Form/Tests/AbstractBootstrap4HorizontalLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap4HorizontalLayoutTest.php
@@ -32,14 +32,12 @@ abstract class AbstractBootstrap4HorizontalLayoutTest extends AbstractBootstrap4
[
./label[@for="name"]
[
- ./div[
- ./ul
- [./li
- [./span[.="[trans]Error[/trans]"]]
- [./span[.="[trans]Error![/trans]"]]
- ]
- [count(./li)=1]
- ]
+ ./span[@class="alert alert-danger"]
+ [./span[@class="mb-0 d-block"]
+ [./span[.="[trans]Error[/trans]"]]
+ [./span[.="[trans]Error![/trans]"]]
+ ]
+ [count(./span)=1]
]
/following-sibling::div[./input[@id="name"]]
]
diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php
index b9e8a38e0f..6e448c413a 100644
--- a/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap4LayoutTest.php
@@ -32,14 +32,12 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest
[
./label[@for="name"]
[
- ./div[
- ./ul
- [./li
- [./span[.="[trans]Error[/trans]"]]
- [./span[.="[trans]Error![/trans]"]]
- ]
- [count(./li)=1]
- ]
+ ./span[@class="alert alert-danger"]
+ [./span[@class="mb-0 d-block"]
+ [./span[.="[trans]Error[/trans]"]]
+ [./span[.="[trans]Error![/trans]"]]
+ ]
+ [count(./span)=1]
]
/following-sibling::input[@id="name"]
]
@@ -162,22 +160,18 @@ abstract class AbstractBootstrap4LayoutTest extends AbstractBootstrap3LayoutTest
$html = $this->renderErrors($view);
$this->assertMatchesXpath($html,
-'/div
+'/span
[@class="alert alert-danger"]
[
- ./ul
- [@class="list-unstyled mb-0"]
- [
- ./li
- [./span[.="[trans]Error[/trans]"]]
- [./span[.="[trans]Error 1[/trans]"]]
-
- /following-sibling::li
- [./span[.="[trans]Error[/trans]"]]
- [./span[.="[trans]Error 2[/trans]"]]
- ]
- [count(./li)=2]
+ ./span[@class="mb-0 d-block"]
+ [./span[.="[trans]Error[/trans]"]]
+ [./span[.="[trans]Error 1[/trans]"]]
+
+ /following-sibling::span[@class="mb-0 d-block"]
+ [./span[.="[trans]Error[/trans]"]]
+ [./span[.="[trans]Error 2[/trans]"]]
]
+ [count(./span)=2]
'
);
}