From c87531ee4b3df392dbb95bd77ba169ff777e2b5f Mon Sep 17 00:00:00 2001 From: David Grudl Date: Sun, 11 Feb 2024 18:03:59 +0100 Subject: [PATCH] added HTML attribute data-nette-error --- src/Forms/Controls/BaseControl.php | 1 + tests/Forms.Latte3/expected/forms.html | 14 +++++++------- tests/Forms/expected/Forms.renderer.1.expect | 8 ++++---- tests/Forms/expected/Forms.renderer.2.expect | 6 +++--- .../Forms/expected/Forms.renderer.translate.expect | 2 +- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/Forms/Controls/BaseControl.php b/src/Forms/Controls/BaseControl.php index 8d727ce5f..f7e2ac3ba 100644 --- a/src/Forms/Controls/BaseControl.php +++ b/src/Forms/Controls/BaseControl.php @@ -234,6 +234,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 ddf573e20..30672133c 100644 --- a/tests/Forms.Latte3/expected/forms.html +++ b/tests/Forms.Latte3/expected/forms.html @@ -8,12 +8,12 @@ - + error
- + error @@ -43,11 +43,11 @@ - + - + @@ -89,17 +89,17 @@
- +
- +
- +
diff --git a/tests/Forms/expected/Forms.renderer.1.expect b/tests/Forms/expected/Forms.renderer.1.expect index 8b0082a2e..71aeb6b7f 100644 --- a/tests/Forms/expected/Forms.renderer.1.expect +++ b/tests/Forms/expected/Forms.renderer.1.expect @@ -14,7 +14,7 @@ - + Enter your age @@ -54,14 +54,14 @@ - + Enter your shipping address - + Select your country @@ -81,7 +81,7 @@ - + Reenter your password diff --git a/tests/Forms/expected/Forms.renderer.2.expect b/tests/Forms/expected/Forms.renderer.2.expect index 4fbec753b..4b4872f59 100644 --- a/tests/Forms/expected/Forms.renderer.2.expect +++ b/tests/Forms/expected/Forms.renderer.2.expect @@ -13,14 +13,14 @@
-
• +
Age must be numeric value
-
+
Please select a valid option.
@@ -73,7 +73,7 @@
-
(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/expected/Forms.renderer.translate.expect b/tests/Forms/expected/Forms.renderer.translate.expect index e1230b986..125b4ac49 100644 --- a/tests/Forms/expected/Forms.renderer.translate.expect +++ b/tests/Forms/expected/Forms.renderer.translate.expect @@ -15,7 +15,7 @@ - + WEAK PASSWORD