[!!!][BUGFIX] Fix wrong error path of validation 53/56053/3
authorDaniel Siepmann <noreply@example.com>
Fri, 15 Sep 2017 22:55:34 +0000 (00:55 +0200)
committerBenjamin Kott <benjamin.kott@outlook.com>
Thu, 8 Mar 2018 10:14:49 +0000 (11:14 +0100)
Add the form name as top level property to the validation results to let
the form field viewhelper attribute "errorClass" work.

Releases: master, 8.7
Resolves: #82093
Change-Id: I2d1c0845c5ab15d68393d5b491bf26db8f3f17c0
Reviewed-on: https://review.typo3.org/56053
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com>
Tested-by: Benjamin Kott <benjamin.kott@outlook.com>
typo3/sysext/core/Documentation/Changelog/8.7.x/Breaking-82093-ExtFormFieldPartialChanged.rst [new file with mode: 0644]
typo3/sysext/form/Classes/Domain/Runtime/FormRuntime.php
typo3/sysext/form/Resources/Private/Frontend/Partials/Field/Field.html

diff --git a/typo3/sysext/core/Documentation/Changelog/8.7.x/Breaking-82093-ExtFormFieldPartialChanged.rst b/typo3/sysext/core/Documentation/Changelog/8.7.x/Breaking-82093-ExtFormFieldPartialChanged.rst
new file mode 100644 (file)
index 0000000..5c4c94b
--- /dev/null
@@ -0,0 +1,57 @@
+.. include:: ../../Includes.txt
+
+=================================================================
+Breaking: #82093 - EXT:form Partials/Field/Field.html has changed
+=================================================================
+
+See :issue:`82093`
+
+Description
+===========
+
+To let the form field viewhelper attribute errorClass work, the partial
+"EXT:form/Resources/Private/Frontend/Partials/Field/Field.html" has been changed.
+
+.. code-block:: html
+
+   <f:form.validationResults for="{element.identifier}">
+
+has been changed to
+
+.. code-block:: html
+
+   <f:form.validationResults for="{element.rootForm.identifier}.{element.identifier}">
+
+
+Impact
+======
+
+Users who overwrite this partial by its own partial have to make adjustments.
+Otherwise no "has-error" class will be rendered in case of form validation errors
+into the parents <div class="form-group"> and the <span class="help-block">
+content will not be rendered.
+
+
+Affected Installations
+======================
+
+All installations with overwritten partial "EXT:form/Resources/Private/Frontend/Partials/Field/Field.html"
+
+
+Migration
+=========
+
+Change the partial Field/Field.html within your site package.
+
+.. code-block:: html
+
+   <f:form.validationResults for="{element.identifier}">
+
+change to
+
+.. code-block:: html
+
+   <f:form.validationResults for="{element.rootForm.identifier}.{element.identifier}">
+
+
+.. index:: Frontend, ext:form, NotScanned
index 0563bc3..fd52bbc 100644 (file)
@@ -508,7 +508,7 @@ class FormRuntime implements RootRenderableInterface, \ArrayAccess
                         $exception
                     );
                 }
-                $result->forProperty($propertyPath)->merge($processingRule->getProcessingMessages());
+                $result->forProperty($this->getIdentifier() . '.' . $propertyPath)->merge($processingRule->getProcessingMessages());
                 $this->formState->setFormValue($propertyPath, $value);
             }
         }
index 6b1107e..3b01de7 100644 (file)
@@ -1,5 +1,5 @@
 <html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:formvh="http://typo3.org/ns/TYPO3/CMS/Form/ViewHelpers" data-namespace-typo3-fluid="true">
-<f:form.validationResults for="{element.identifier}">
+<f:form.validationResults for="{element.rootForm.identifier}.{element.identifier}">
        <div class="form-group{f:if(condition: '{validationResults.errors.0}', then: ' has-error')}">
                <f:if condition="{doNotShowLabel} != 1">
                        <label class="control-label" for="{element.uniqueIdentifier}">{formvh:translateElementProperty(element: element, property: 'label')}<f:if condition="{element.required}"><f:render partial="Field/Required" /></f:if></label>