Issue Bug Closed

#100301Undefined array key for form fields of type checkbox

David Bruchmann 03/25/23, 14:50 updated 04/19/23, 13:50

Description

Defining a form like this

type: Form
prototypeName: standard
identifier: variant-Test
label: Newsletter Subscription
renderables:
  -
    type: Page
    identifier: page-1
    label: General data
    renderables:
      -
        type: Text
        identifier: email-address
        label: Email address
        defaultValue:
        variants:
          -
            identifier: validation-1
            condition: 'formValues["checkbox-1"] == 1'
            properties:
              fluidAdditionalAttributes:
                required: required
            validators:
              -
                identifier: NotEmpty
              -
                identifier: EmailAddress
      -
        type: Checkbox
        identifier: checkbox-1
        label: Check this and email will be mandatory

throws an error when the checkbox is not checked:

PHP Warning: Undefined array key "checkbox-1" in /var/www/html/vendor/symfony/expression-language/Node/GetAttrNode.php line 97

Select fields with empty value option behave probably similar.
I’m not sure if all cases would be covered then.

Reviews 0

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