Checkboxes issue

Created on 11 February 2021, almost 4 years ago
Updated 6 March 2024, 10 months ago

Problem/Motivation

After adding a checkboxes element (not a checkbox, but checkboxes!), any edit of a form element will result in a fatal error.

The problem seems to be generated in Conditions::webformElementStatesAfterBuild(), when generating the possible options for the element field under the Conditions settings. As it can be seen in the attached screenshot, for checkboxes, there is a different array structure for the element, it is not just a simple string key to string value relation.

Proposed resolution

What the current code does is just to remove the current element from the available options. Because handling checkboxes (or multiple value elements) seems to be tricker within that array structure, a proposed solution would be to just ignore them. As a consequence, for checkboxes, the current element will also appear in the available element options list, under the Conditions setting.

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇷🇴Romania vasi1186

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇮Finland merilainen

    Can you provide steps how to reproduce? I don't get any errors if I add checkboxes element to a webform.

    Your patch can also generate a warning about "Undefined index" if the none of the keys in $row['selector']['#options'][$selector] are set.

Production build 0.71.5 2024