diff --git a/src/Forms/Controls/BaseControl.php b/src/Forms/Controls/BaseControl.php
index 827f85a11..004f4cb8d 100644
--- a/src/Forms/Controls/BaseControl.php
+++ b/src/Forms/Controls/BaseControl.php
@@ -246,6 +246,7 @@ public function getControl(): Html|string
'required' => $this->isRequired(),
'disabled' => $this->isDisabled(),
'data-nette-rules' => Nette\Forms\Helpers::exportRules($this->rules) ?: null,
+ 'data-nette-error' => $this->hasErrors(),
]);
}
diff --git a/tests/Forms.Latte3/expected/forms.html b/tests/Forms.Latte3/expected/forms.html
index 42933f658..fc6d08f00 100644
--- a/tests/Forms.Latte3/expected/forms.html
+++ b/tests/Forms.Latte3/expected/forms.html
@@ -8,12 +8,12 @@
Username:
-
+
error
-
+
error
male female
@@ -43,11 +43,11 @@
Username:
Name
-
+
Username:
-
+
My
@@ -85,17 +85,17 @@
@@ -112,4 +112,4 @@
Sex:
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/tests/Forms/Forms.renderer.1.expect b/tests/Forms/Forms.renderer.1.expect
index 98d298a58..3379e91eb 100644
--- a/tests/Forms/Forms.renderer.1.expect
+++ b/tests/Forms/Forms.renderer.1.expect
@@ -14,7 +14,7 @@
Your age:
-
+
Enter your age
@@ -54,14 +54,14 @@
City:
-
+
Enter your shipping address
Country:
- Select your country Czech Republic Slovakia United Kingdom Canada United States other
+ Select your country Czech Republic Slovakia United Kingdom Canada United States other
Select your country
@@ -81,7 +81,7 @@
Choose password:
-
+
Reenter your password
diff --git a/tests/Forms/Forms.renderer.2.expect b/tests/Forms/Forms.renderer.2.expect
index 4fbec753b..4b4872f59 100644
--- a/tests/Forms/Forms.renderer.2.expect
+++ b/tests/Forms/Forms.renderer.2.expect
@@ -13,14 +13,14 @@
Your age:
- •
+ •
Age must be numeric value
Your gender:
- male female
+ male female
Please select a valid option.
@@ -73,7 +73,7 @@
Choose password:
- • (at least 3 characters)
+ • (at least 3 characters)
The password is too short: it must be at least 3 characters
diff --git a/tests/Forms/Forms.renderer.translate.expect b/tests/Forms/Forms.renderer.translate.expect
index e1230b986..125b4ac49 100644
--- a/tests/Forms/Forms.renderer.translate.expect
+++ b/tests/Forms/Forms.renderer.translate.expect
@@ -15,7 +15,7 @@
PASSWORD
-
+
WEAK PASSWORD