When viewing submissions, an unchecked checkbox which has #exclude_empty is:

  • correctly hidden for html and text formats
  • correctly visible on YAML (because everything should be)
  • wrongly visible on table format (entity.webform_submission.table)

The attached webform has full instructions to reproduce (and has an extra checkbox to test conditional visibility).

Comments

wturrell created an issue. See original summary.

jrockowitz’s picture

A single checkbox's #exclude_empty_checkbox option is handled via \Drupal\webform\Plugin\WebformElement\Checkbox::build.

Can you provide an example of the problem that we can use to fix the issue.

jrockowitz’s picture

Status: Active » Postponed (maintainer needs more info)
wturrell’s picture

Title: How does #exclude_empty actually work? » #exclude_empty ignored on submission table view
Category: Support request » Bug report
Issue summary: View changes
StatusFileSize
new6.64 KB

Two mistakes I made when reporting this:

  • first I failed to tell you I was talking about table view, not HTML.
  • secondly, when I said I wasn't able to reproduce on a clean install, actually I did, but I didn't notice I was looking at the wrong route…

Issue summary updated and test webform created (as you'll from the markup, I've determined where it breaks, but I got confused trying to debug it further).

jrockowitz’s picture

I am able to replicate this issue.

It seems like we have to refactor one or two things and then add a \Drupal\webform\Plugin\WebformElementInterface::isEmptyElementExclude(array $element) helper method.

jrockowitz’s picture

Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new6.62 KB
wturrell’s picture

StatusFileSize
new736 bytes
new6.61 KB

Fixes typo that was passing wrong array to isEmptyExcluded()

wturrell’s picture

Here's a second webform that uses 'submission_exclude_empty_checkbox', rather than individual '#exclude_empty' keys.
I've tested the patch with both forms (also with checkboxes ticked) and it seems fine.

  • jrockowitz committed 175e316 on 8.x-5.x authored by wturrell
    Issue #3009289 by wturrell, jrockowitz: #exclude_empty ignored on...
jrockowitz’s picture

Status: Needs review » Fixed

@wturrell Thanks for reviewing the patch.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.