Form Viewhelpers: Attribute errorClass not working
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:
The working validation error detection can be found in the lines 96 - 99.
Updated by Justus Moroni over 6 years ago
Here are the documentations for this functionality.