Bug #89236

TYPO3 Forms Extension: Required - Indicators (*) are not shown

Added by Matthias Gwiozda 4 months ago. Updated 17 days ago.

Status:
Needs Feedback
Priority:
Should have
Category:
Form Framework
Target version:
-
Start date:
2019-09-24
Due date:
% Done:

0%

TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

There is a bug in the typo3 form Plugin in Version 9.5 (File: Resources/Private/Frontend/Partials/Field/Field.html):

<label class="control-label" for="{element.uniqueIdentifier}">{formvh:translateElementProperty(element: element, property: 'label')}<f:if ="{element.required}"><f:render partial="Field/Required" /></f:if></label>


The condition {element.required} is never met and the required - indicator (*) is never displayed.

The correct condition is {element.properties.fluidAdditionalAttributes.required}:

<label class="control-label" for="{element.uniqueIdentifier}">{formvh:translateElementProperty(element: element, property: 'label')}<f:if condition="{element.properties.fluidAdditionalAttributes.required}"><f:render partial="Field/Required" /></f:if></label>


There are more places (Templates) where {element.required} is used

There is an image attached to this issue that shows the <f:debug>{element}</f:debug> at the field.html.

required_forms.png View (36.6 KB) Matthias Gwiozda, 2019-09-24 08:13

kontakt.form.yaml View (3.58 KB) Matthias Gwiozda, 2019-11-22 09:22

9.5.12-dev.png View (16.8 KB) Ralf Zimmermann, 2019-11-22 16:40

10.2.0-dev.png View (18.7 KB) Ralf Zimmermann, 2019-11-22 16:41


Related issues

Related to TYPO3 Core - Bug #88730: Validators of a field with the same identifier is working only once on a page Closed 2019-07-11
Related to TYPO3 Core - Bug #90083: Validators are empty if the same form is rendered multiple times on a page Under Review 2020-01-10

History

#1 Updated by Michael Stucki 4 months ago

  • Project changed from forge.typo3.org to TYPO3 Core
  • Category deleted (Development)
  • TYPO3 Version set to 10

#2 Updated by Georg Ringer 4 months ago

  • Category set to Form Framework

#3 Updated by Susanne Moog 2 months ago

  • Sprint Focus set to Remote Sprint

#4 Updated by Ralf Zimmermann 2 months ago

`{element.required}` is a form element API (https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/form/Classes/Domain/Model/FormElements/AbstractFormElement.php#L129) which checks for the existance of the `NotEmptyValidator`.
Can you provide your full form definition? Did the `NotEmptyValidator` exists within your form element?

#5 Updated by Ralf Zimmermann 2 months ago

  • Status changed from New to Needs Feedback
  • Assignee set to Matthias Gwiozda

#6 Updated by Matthias Gwiozda 2 months ago

Ralf Zimmermann wrote:

`{element.required}` is a form element API (https://github.com/TYPO3/TYPO3.CMS/blob/master/typo3/sysext/form/Classes/Domain/Model/FormElements/AbstractFormElement.php#L129) which checks for the existance of the `NotEmptyValidator`.
Can you provide your full form definition? Did the `NotEmptyValidator` exists within your form element?

I appended the yaml - File in this answer

#7 Updated by Matthias Gwiozda 2 months ago

  • File kontakt.form.yaml added

#8 Updated by Matthias Gwiozda 2 months ago

  • File deleted (kontakt.form.yaml)

#9 Updated by Ralf Zimmermann 2 months ago

  • Status changed from Needs Feedback to New
  • Assignee deleted (Matthias Gwiozda)

#10 Updated by Ralf Zimmermann 2 months ago

I can not reproduce the issue with fresh instances for TYPO3 10.2.0-dev and 9.5.12-dev

  1. 9.5.12-dev


  1. 10.2.0-dev

#11 Updated by Ralf Zimmermann 2 months ago

  • Status changed from New to Needs Feedback
  • Assignee set to Matthias Gwiozda

In which exact version of TYPO3 you can produce this issue?

#12 Updated by Mathias Brodala 2 months ago

Could it be that you have placed the same form more than once on the same page? There is a known issue (#88730) which prevents validators from being added to anything but the 1st instance of a form on a page.

#13 Updated by Bjoern Jacob 2 months ago

  • Sprint Focus deleted (Remote Sprint)

#14 Updated by Bjoern Jacob 2 months ago

  • Related to Bug #88730: Validators of a field with the same identifier is working only once on a page added

#15 Updated by Matthias Gwiozda 2 months ago

Mathias Brodala wrote:

Could it be that you have placed the same form more than once on the same page? There is a known issue (#88730) which prevents validators from being added to anything but the 1st instance of a form on a page.

The Form is only once at this page. Here it is: https://www.sws-energie.de/privatkunden/info-formulare/kontakt

#16 Updated by Bjoern Jacob 2 months ago

  • Subject changed from Typo3 Forms Extension: Required - Indicators (*) are not shown to TYPO3 Forms Extension: Required - Indicators (*) are not shown

Please provide more information. Which templates did you override? Which parts did you customize?

#17 Updated by Matthias Gwiozda 2 months ago

Bjoern Jacob wrote:

Please provide more information. Which templates did you override? Which parts did you customize?

I didn't override the Templates. I just created a simple Form and added some required Fields.

#18 Updated by Riccardo De Contardi about 2 months ago

At a quick glance I am not able to reproduce this issue with TYPO3 9.5.11 - plain TYPO3 installation

#19 Updated by Ralf Zimmermann 17 days ago

  • Related to Bug #90083: Validators are empty if the same form is rendered multiple times on a page added

#20 Updated by Matthias Gwiozda 17 days ago

Riccardo De Contardi wrote:

At a quick glance I am not able to reproduce this issue with TYPO3 9.5.11 - plain TYPO3 installation

It looks like there is something customized in our extension that causes the problem.
If this problem doesn't show up on a plain TYPO3 installation I have to search for the cause - but at the moment it doesn't look like that I got time for this (sorry).

Lets close this issue for now and pretend it's some magic that's just happening in our TYPO3 - Instance for whatever reason.

#21 Updated by Bjoern Jacob 17 days ago

@Matthias we are having the same problem in one of our instances. See the connected issue. Maybe you can apply the patch and see if your problem is solved. Ralf wrote a huge explanation.

Also available in: Atom PDF