Project

General

Profile

Actions

Bug #101458

closed

Form Variants with conditions on values crash

Added by Angelika Kusel 11 months ago. Updated 4 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Form Framework
Target version:
-
Start date:
2023-07-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
12
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

*Versions of relevant Components:

Typo3-Version: 12.4.3
PHP Version: 8.1
CMS-Form: 12.4.3

*Steps to Reproduce:

Step 1: Design a form with variants and introduce a condition basing on value of a form element

Example with such a constellation is attached -> so feel free to try this.

Step 2: Try to include this form on an arbitrary page and call it in the frontend

*Result:

An exception is thrown, saying that the array key is not defined although it should be:

(1/1) #1476107295 TYPO3\CMS\Core\Error\Exception
PHP Warning: Undefined array key "checkbox-1" in /var/www/html/vendor/symfony/expression-language/Node/GetAttrNode.php line 133


Files

typo3_bug.png (51.2 KB) typo3_bug.png Angelika Kusel, 2023-07-27 10:09
HideSteps.form.yaml (992 Bytes) HideSteps.form.yaml Angelika Kusel, 2023-07-27 10:10
Actions #1

Updated by Fronzes Philippe 10 months ago

I also have this error.

I investigate a bit.
When the form is first build (function initializeFormStateFromRequest() in FormRuntime.php), the formState is empty, and therefore also the "formValues" array.
The variants are then evaluate, with an empty formValues array.

I gess variants based on formValues should be evaluated only on form submission?

Actions #2

Updated by Georg Ringer 4 days ago

  • Status changed from New to Closed

this can be solved by using

condition: 'traverse(formValues, "checkbox-1") == 1'

see also examples at https://docs.typo3.org/c/typo3/cms-form/main/en-us/I/Concepts/Variants/Index.html

Actions

Also available in: Atom PDF