Issue Bug Closed

#98197Undefined array key in form variants if variable of variant condition is empty

Lidia Demin 08/24/22, 10:00 updated 08/25/22, 08:31

Description

I have a radio “contactType” with default value preset. Depending on the contact type I want to add dynamic validation to following input fields (email, phone, …). The configuration looks like this:

                  -
                    identifier: contactType
                    type: RadioButton
                    defaultValue: email
                    properties:
                      optionClass: c7of24
                      options:
                        email: 'E-Mail'
                        phone: 'Telefon'
                        mail: 'Post'
                  -
                    identifier: email
                    type: Text
                    properties:
                      type: email
                    variants:
                      - identifier: contactType-email
                        condition: 'formValues["contactType"] == "email"'
                        validators:
                          - identifier: NotEmpty
                          - identifier: EmailAddress

Sadly, I get the following Exception on the initial form call:
>PHP Warning: Undefined array key “contactType” in /var/www/html/www/vendor/symfony/expression-language/Node/GetAttrNode.php line 97

Running TYPO3 11.5 with PHP 8.0.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.