I would like to display a field when certain checkbox is unchecked/off, unfortunately js is not handling that case. I only works for reverse case: hide a field when checkbox is checked/on.

CommentFileSizeAuthor
#1 conditional_fields_unchecked.patch1.06 KBDevElCuy
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DevElCuy’s picture

Validation filter was changed, it now looks for all checkboxes in field and returns object value if checked or ""(empty string) if unchecked.

Blessings!

peterpoe’s picture

I'm sorry, but I don't understand what kind of functionality you are proposing.

peterpoe’s picture

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

I have an integer field with 2 posible values: 0 and 1. It is also configured to work as checkbox, so, when checked it returns 1 and when unchecked it returns 0. Problem is that I need to display a conditional field when checkbox is unchecked, I mean, when it returns 0. Current javascript handling of unchecked checkbox does not returns 0, it returns null instead and does not triggers the displaying of conditional fields.
In short, when conditional fields is configured to display A field when B field es unchecked. B field is never displayed.

Blessings!

jim0203’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

I've got the same problem, in D6. If a single checkbox is checked, and a field is set to display when that checkbox is checked, it displays. But if the field is set to display when the checkbox is unchecked, it never displays.

peterpoe’s picture

Title: Handle NULL/empty value of checkbox » Option to negate trigger values
Component: Javascript » Code
Category: bug » feature
Status: Postponed (maintainer needs more info) » Postponed

This can't be fixed for now: since the "off" value of the checkbox field is not present in the output, Conditional Fields can't check its settings against it. If we don't want to insert nasty hacks in the javascript, like checking if there is only one checkbox in the field – and we don't – the only way to fix this issue properly is to add a "negate" condition in the controlled field settings.
Since this would be an entirely new feature, it is postponed after 1.0 release.

peterpoe’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Status: Postponed » Active

This would be a nice to have, but we don't have a db row and a UI for per field settings.
I created a new issue that needs to be solved before this feature can be implemented: #718138: Per field settings (instead of per content type)

locomo’s picture

this would be a very helpful feature

YK85’s picture

+1 subscribing

mautumn’s picture

Created a new issue about this #866914: Unsupported single on/off checkbox widget field to hopefully better highlight this issue.

Swipular’s picture

+1 subscribing

bwinett’s picture

+1 subscribing

mordek’s picture

+1 subscribing

peterpoe’s picture

Issue summary: View changes
Status: Active » Closed (outdated)