Skip to content

Form variants have no effect on the formDefinition #863

@kubilaymelnikov

Description

@kubilaymelnikov

Describe the bug
When using TYPO3 Form Variants, they have no effect on the frontend output.
The defined variants are correctly generated as configuration, but when a condition matches, the intended overrides are not applied.

To Reproduce
You can test this by creating a condition that is always true. Then set an xDebug breakpoint in FormFrontendController.php at line 128 and compare the definition in $formDefinitionObj with the actual frontend output.

Expected behavior
In FormFrontendController.php, the $formDefinition array is assembled manually, without respecting the possible modifications made by the FormRuntime.
At line 145, the renderables from the previously loaded form configuration are passed along. At this point, the data should instead be taken from $formDefinitionObj.

The $formDefinitionObj contains the correct formDefinition as modified by the conditions.

TYPO3 version and TYPO3 Headless version
headless: ^4.5
typo3: ^13.4

Use case
Our customer wants certain selection fields to disappear based on a specific choice in a select box.
Since I want to avoid hardcoded solutions, I would like to implement this using the mechanisms provided by TYPO3.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions