Bug #82093

Form Viewhelpers: Attribute errorClass not working

Added by Justus Moroni over 2 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Must have
Category:
Form Framework
Target version:
Start date:
2017-08-13
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

It seems that the attribute "errorClass" in the fluid form viewhelpers is not working. The default "error" is not shown when an validation error is given.
The normal "ValidationResults" is detecting the errors with not problems.

With the newly releases beta of bootstrap 4 the framework changed the validation handling. This is no longer a class on the "form-group" element. The new method adds an class on the input,textarea oder select tag "is-invalid".
Therefore the functionality with "errorClass" would be perfect here.

The form extension uses the attribute in the partials as well. They are not working either.

Using the functionality of "ValidationResultsViewHelper" inside of "AbstractFormFieldViewHelper->setErrorClassAttribute" is not working either.

I'm not sure if this is an issue regarding the fluid viewhelpers or the form extension. Maybe both.

This behaviour can be seen when the core form extension is used in CMS 8.
Every form tag should've an class "error" on validation when the field is not valid.

I've detected this behaviour in using the "TYPO3\CMS\Fluid\ViewHelpers\Form\TextfieldViewHelper". Maybe this is working with other viewhelpers.

The files to check in are the following:
- typo3/sysext/form/Resources/Private/Frontend/Partials/Text.html > Line 8
- typo3/sysext/fluid/Classes/ViewHelpers/Form/TextfieldViewHelper.php > Line 89
- typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormFieldViewHelper.php > Line 317 - 335

The working validation viewhelper is the following:
- typo3/sysext/fluid/Classes/ViewHelpers/Form/ValidationResultsViewHelper.php

The working validation error detection can be found in the lines 96 - 99.

Bildschirmfoto 2017-08-13 um 20.48.02.png View (352 KB) Justus Moroni, 2017-08-13 20:51


Related issues

Related to TYPO3 Core - Bug #84175: Remove duplicate ReST file Closed 2018-03-08
Duplicated by TYPO3 Core - Task #82493: BUGFIX: Fix wrong error path of validation Closed 2017-09-16
Duplicates TYPO3 Core - Bug #82248: Error class is not set on input fields Closed 2017-08-30

Associated revisions

Revision b3190c3b (diff)
Added by Daniel Siepmann over 1 year ago

[!!!][BUGFIX] Fix wrong error path of validation

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 <>
Tested-by: Mathias Schreiber <>
Tested-by: TYPO3com <>
Reviewed-by: Benjamin Kott <>
Tested-by: Benjamin Kott <>

Revision e2af7c6e (diff)
Added by Daniel Siepmann over 1 year ago

[!!!][BUGFIX] Fix wrong error path of validation

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 <>
Reviewed-by: Benjamin Kott <>
Tested-by: Benjamin Kott <>

Revision ea406050 (diff)
Added by Christian Kuhn over 1 year ago

[BUGFIX] Remove a duplicate ReST file

ReST file back ported to v8 should be added to 8.7.x/ folder in
core master branch only. Patch for issue #82093 copied the file
to master/ folder, this dupe is removed again.

https://docs.typo3.org/typo3cms/extensions/core/latest/Changelog/Howto.html
for more details on this.

Resolves: #84175
Related: #82093
Releases: master
Change-Id: Ibcd26da62b2c5d7a270a54c5fbe0d72964da6675
Reviewed-on: https://review.typo3.org/56055
Reviewed-by: Mathias Schreiber <>
Tested-by: Mathias Schreiber <>
Reviewed-by: Andreas Fernandez <>
Tested-by: Andreas Fernandez <>

History

#1 Updated by Justus Moroni over 2 years ago

I've added an screenshot with the rendering of the form partial "Text".

#3 Updated by Daniel Siepmann about 2 years ago

  • Priority changed from Should have to Must have

#4 Updated by Gerrit Code Review about 2 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54150

#5 Updated by Susanne Moog about 2 years ago

  • Duplicated by Task #82493: BUGFIX: Fix wrong error path of validation added

#6 Updated by Gerrit Code Review about 2 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54150

#7 Updated by Gerrit Code Review about 2 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54150

#8 Updated by Johannes Hollmann about 2 years ago

I have tested the fix. The property elementErrorClassAttribute works now correctly.
But the fix brings another issue. Now the validationResults.errors and validationResults.flattenedErrors are not rendered in the fluid-templates

#9 Updated by Ralf Zimmermann almost 2 years ago

  • Assignee set to Ralf Zimmermann

#10 Updated by Ralf Zimmermann over 1 year ago

  • Duplicates Bug #82248: Error class is not set on input fields added

#11 Updated by Ralf Zimmermann over 1 year ago

  • Category changed from Fluid to Form Framework

#12 Updated by Ralf Zimmermann over 1 year ago

  • Status changed from Under Review to Closed

#13 Updated by Gerrit Code Review over 1 year ago

  • Status changed from Closed to Under Review

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54150

#14 Updated by Gerrit Code Review over 1 year ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54150

#15 Updated by Gerrit Code Review over 1 year ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54150

#16 Updated by Gerrit Code Review over 1 year ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/54150

#17 Updated by Gerrit Code Review over 1 year ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56053

#18 Updated by Gerrit Code Review over 1 year ago

Patch set 2 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/56053

#19 Updated by Anonymous over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#20 Updated by Oliver Hader over 1 year ago

  • Target version set to 8.7.11

#21 Updated by Christian Kuhn over 1 year ago

  • Related to Bug #84175: Remove duplicate ReST file added

#22 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF