I was wondering if it is currently possible to show the controlled field if any of the controller fields is selected.
Essentially show if 'a' OR 'b' OR 'c' etc
At this moment if I select a, b, c as controlling field d, all 3 have to be selected for field d to show.

Thank you very much.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rburgundy’s picture

Title: show if any of controller fields selected » show if ANY of controller fields are selected (OR vs AND controllers)
peterpoe’s picture

Not at the moment.
#718138: Per field settings (instead of per content type) must be solved before we can add this kind of logic.

YK85’s picture

Hello peterpoe,

Thanks always for your great work.
Do you have an idea of when this feature may be available? I really need this OR functionality and looking for workarounds without any luck.

Thanks!

peterpoe’s picture

You would have to modify both the javascript and the nodeapi function to make it work with OR. I will work on per field settings in the following days, then this should come right after.

YK85’s picture

awesome! thanks for the kind explanation.
i look forward to your work =)

Bilmar’s picture

+1 subscribing

locomo’s picture

subscribe

YK85’s picture

peterpoe - I wanted to let you know about #735528: FAPI #states: Fix conditionals to allow OR and XOR constructions
May I kindly ask if we would be able to expect the OR functionality in the coming weeks?
Thanks!

robby.smith’s picture

+1 subscribing

threexk’s picture

Subscribe. Two years later, I'm still in need of a way to OR controlling fields. :) I may try to work a patch in the coming weeks to support either AND or OR.

robby.smith’s picture

threexk - it would be AWESOME if you could create a patch to allow OR functionality! I will be first in line to do extensive testing with feedback.

Bilmar’s picture

Hi threexk,

I was wondering if you were able to develop 'OR' functionality by any chance?
Would really appreciate your support.

Thanks!

fschaff’s picture

Subscribe

Jonasvh’s picture

also interested
thanks

threexk’s picture

Here is a patch to add support for ORed controllers. For any controlled field, you can choose under 'Conditional fields settings' whether:
1. All the controlling fields must have trigger values selected for the controlled field to be displayed (boolean AND).
2. Any controlling field must have a trigger value selected for the controlled field to be displayed (boolean OR).

The patch is not suitable for commit--it works in a crude way and it duplicates a lot of code--but I'm posting it in case anyone really needs this functionality. I'm hoping to make a second pass in the future, now that I understand the code better, to try to come up with something worthy of consideration for commit.

Installing:
1. Patch DRUPAL-6--2 branch.
2. Run update.php.

Uninstalling:
1. Restore files from released version of module.
2. Delete 'boolean_operator' column from 'conditional_fields' table.

Known limitations:
1. Nested conditional fields don't work with OR in this patch. Nested conditional fields should still work as before with AND though. [Example: If you have fields A and B that control a field C, and C controls another field D, things will not work properly if A and B are using the OR operator.]
2. You cannot combine AND and OR to construct more complicated boolean logic for deciding whether a field should be shown. [Example: For a controlled field D with three controlling fields A, B, and C, you cannot do something like D = A AND (B OR C).]

If you try this patch and run into any other problems besides those two, I'd be interested to know. Conditional groups should work, but I have not tested them. Orphan settings might work, but I haven't tested them either.

How the patch works:
It adds a column 'boolean_operator' to the 'conditional_fields' table. Every field gets a boolean operator, AND is the default. Basically anywhere in the code where it checks that all the controlling fields have trigger values selected, I added a conditional for OR that checks whether any of the controlling fields have triggered values selected.

Thanks, peterpoe (and other contributors), for writing such good code that I was able to figure it out enough to get this somewhat working (I think).

threexk’s picture

Whoops, the previous patch did not default existing fields to AND (I accidentally attached an old one). Use this one:

robby.smith’s picture

Status: Active » Needs review

Great work!! I will definitely be testing this soon and will report back if I come across any issues besides the limitations mentioned. It would be really awesome to see this further developed and committed to 2.x-dev. However, I read in another post that peterpoe is working on a 3.x branch that will hopefully have this functionality and others. I hope peterpoe will be able to comment on your code that allows boolean_or functionality. Thanks!

YK85’s picture

I was wondering if any has had any further process with this feature?
Thank you

robby.smith’s picture

having this feature in Conditional Fields shipped would be great!

benone’s picture

subscrrrrr

bcrogers’s picture

Very interested in this feature.

KevinKydd’s picture

I have been using this patch on my site and it works well for the most part. The one flaw that is very glaring is that if I set a field as a controlling field for multiple other fields if I go back and change that field's own controlling field, the fields it controls inherit the same controlling fields. I know that sounds confusing but it looks something like this:

Field 1
--Field 2
----Field 3
----Field 4
----Field 5

Now if I change Field 2's controlling field to Field 1 AND Field 6 after I already created Field's 3-5, it will set Fields 1 and 6 as controlling fields for Fields 3-5 even though I didn't try to do that.

Also, my site has become very dependent on the OR functionality at this point. Will there be a commit on this issue any time soon? If I update to the newest beta will this patch need to be reinstalled?

chuckbar77’s picture

Great module! Would love to see this feature in D6 before D7!

YK85’s picture

Hi peterpoe, I was wondering if you may have had time to develop the 3.x version with this feature? Thanks!

rburgundy’s picture

bump

droid19’s picture

Subscribe

pedrosp’s picture

Version: 6.x-2.x-dev » 6.x-2.0
Component: Miscellaneous » Code

Just arrived to this patch, and seems not working anymore with the current release.
The Ui on the field form seems ok, but not the behavior.
Any chance to have an update to this patch, or even the standard release ?
Thanks.

ydnar79’s picture

By any chance can this patch be modified so it can be used with the D7 version? I know that the interface has changed a LOT.... but I have not had a chance to check the code yet..... So I just figured that I would ask.

WorldFallz’s picture

anyone get this working yet or have an updated patch for d6? I'm probably going to work on this feature, but I'd like to start with the most current info. thanks.

virgo’s picture

subscribe

peterpoe’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)