Skip to content

Commit

Permalink
[!!!][BUGFIX] Fix wrong error path of validation
Browse files Browse the repository at this point in the history
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/54150
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benjamin Kott <benjamin.kott@outlook.com>
Tested-by: Benjamin Kott <benjamin.kott@outlook.com>
  • Loading branch information
Daniel Siepmann authored and benjaminkott committed Mar 8, 2018
1 parent 851d7ef commit b3190c3
Show file tree
Hide file tree
Showing 4 changed files with 116 additions and 2 deletions.
@@ -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
@@ -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
2 changes: 1 addition & 1 deletion typo3/sysext/form/Classes/Domain/Runtime/FormRuntime.php
Expand Up @@ -482,7 +482,7 @@ protected function mapAndValidatePage(Page $page): Result
$exception
);
}
$result->forProperty($propertyPath)->merge($processingRule->getProcessingMessages());
$result->forProperty($this->getIdentifier() . '.' . $propertyPath)->merge($processingRule->getProcessingMessages());
$this->formState->setFormValue($propertyPath, $value);
}
}
Expand Down
@@ -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>
Expand Down

0 comments on commit b3190c3

Please sign in to comment.