I have categorized a content type with taxonomy as such:

Parent category/term 1
- Child category/term 1 (has id 34)
- Child category/term 2 (has id 43)
- Child category/term 3 (has id 46)
Parent category/term 2
Parent category/term 3

When for example child categories/terms 1, 2 and 3 are selected i want to display specific fields. So i created a conditional field that looks like this:

dependent dependees operator description



field_test is visible when field_category has value "46".
field_test is visible when field_category has value "43".
field_test is visible when field_category has value "34".

My problem is that only when the last term added as a condition which is child term 3(id 46), field_test is show. It isn't shown if one of the other two are selected. I´ve tried changing multiple settings for each field, i've tried using only parent terms, i've tried it with different fields, i've tried using XOR instead. It doesn't mater which combination of terms i use. The dependent is always just shown if the dependee that was added last is selected. There is nothing in the drupal logs or java script console and i have little to none php knowledge so i haven't been able to figure this out myself.

Does anyone know if this is a module issue or a configuration issue? Any help is appreciated.

#32 dependent_field_multiple_logic_grouping-1637466-32.patch789 bytesdraenen
PASSED: [[SimpleTest]]: [MySQL] 160 pass(es). View
#14 conditional.png32.58 KBpmichelazzo
#2 multiple_dependency_bug.zip1.48 KBdrillprp
Members fund testing for the Drupal project. Drupal Association Learn more


Sk1Zy’s picture

Gona bump this up, i was able to replicate this bug on a clean acquia dev desktop install where i only installed the conditional fields module.

drillprp’s picture

Component: User interface » Code
Priority: Normal » Critical
1.48 KB

I apologize if I have classified this bug incorrectly, but I have been looking into it and it doesn't seem normal. Attached is a Feature that helps reproduce this bug. This is a major bug as the interface nor the code prevents you from doing this with the silent failure output. Attaching the same dependent to multiple dependees and ORing them results in only the last dependee to function properly.

The feature requires the Dates module.

Output of selection:
n/a -> nothing
first -> long text field
second -> nothing
third -> date field
fourth -> nothing

n/a -> nothing
first -> long text field
second -> long text field
third -> date field
fourth -> date field

pfhsmj0’s picture

I am experiencing this problem but the dependent field only appears unless the first dependee is set to the proper value not the last. Perhaps this has something to do with my condition is based upon the dependee being set to one of three taxonomy values being set rather than selection fields as in
if dependee = V1 then display the dependent field OR
if dependee = V2 then display the dependent field OR
if dependee = V3 then display the dependent field

The dependent field is displayed only when dependee = V1.

pacome’s picture

Same issue for me, the dependent (txt field) appears only with the first dependee (1st category term), not with the second (2nd category term)..
Any idea ?

_ Mazzhe’s picture

I had the same issue. I don't know why it doesn't work, but I know an other way to do the same thing :

dependent dependees operator description
field_test field_category AND field_test is visible when field_category has at least one of the values: 46, 43, 34.

You can choose this in the edit dependency page, in the field Values input mode : "Any of these values (OR)..."
I worked for me.

I have now an other problem, linked to this one. I want to do this :

dependent dependees operator description
field_test field_category OR field_test is visible when field_category has at least one of the values: 46, 43, 34.
field_test is filled with a value when field_category has value : "2"

When I try this, the field_test is never visible nor filled. (I tried with AND and XOR conditions : no change)

dafeder’s picture

Same issue here. Does work if I use "is one of" and enter the values (tids in my case) manuall, but this is not ideal.

hefox’s picture

Looked into this briefly. From what I can tell, it'll take significant patching to get it to work., It'll take both the js and form_after_build being updated. Currently It doesn't have a way to determine which event trigger the effect (just fires whatever one is set for dependent), etc.;

byronveale’s picture

Title: Dependent field doesn't appear with multiple OR/XOR dependees unless last inserted dependee is selected. » Dependent field is not acted upon with multiple OR/XOR dependees unless last inserted dependee is selected.

In my case, the dependent field is filled with a value when the dependee is assigned a value (not revealed). As such, I changed the name of this issue; apologies if I should file this separately.

Same result, though, in that only the last condition is evaluated successfully, the others are ignored, regardless of the interaction (AND, OR, or XOR) selected.

And since the value assigned to the dependent is unique for each value assigned to the dependee, I don't have the option of using "is one of" as mentioned in comment #6.

I'm on Acquia Dev Desktop 7.22.23, Drupal 7.22, Apache 2.2.23, MySQL 5.1.66, php 5.3.18, on OS X 10.8.4.

If you need any more information, do let me know...

pmichelazzo’s picture

I have the same problem. One select box with 4 or 5 options just change the dependent field in the last option.

hollyfox’s picture

I am in dire need of this to set the value of a field based on another field value. Is there any new status from the developers on this issue. In the meantime, I am looking at the code trying to figure out why this is happening.

dafeder’s picture

#10 did you try using "is one of" and entering manual ids?

pmichelazzo’s picture


Any success with this issue? I've trying to find a solution but without success.


rinasek’s picture


My problem was solved when i changed jQuery version to 1.5

Here is mu setup:
Condition: Value
Values input mode: Any of these values(OR)...
Set of values: tids (each tid in separate row)

Setup was OK whole time but problem was in jQuery. Check this issue https://drupal.org/node/2006442


pmichelazzo’s picture

32.58 KB

@rinasek (and following friends)

I don't think so. I still have the same problem. Let me explain the scenario:

I have a field (an entity reference) with a select box widget. This field have a list of products and I call it "field_er_servico"
I have a text field with a text widget for values. This field is empty and receive a value. I call it "field_valor".

Expected behavior: when the user change the field A, some value is filled at field B

The configs you can see at the image attached.

What I did:

1) I've tested every option of interaction (Interaction with other dependencies); AND, OR, XOR with all mix options possibles and nothing happen.
2) I've tested every "Values input mode", including a regular expression and the behavior just fit in the last option of the select box
3) I've tested a list text over an entity reference and nothing happen.
4) I've made all of those tests with jQuery 1.5, 1.7 and 1.8

So, I don't think that's a problem with jQuery. Actually when I change to 1.7 and 1.8 versions, the conditional fields stop (it's not occur with 1.5 version) and the expected behavior just occurs with the last option of the select box.


hollyfox’s picture

I am having the same issue and I am going to check to see what version of JQuery I have. It seems to me that if the problem is solved with a specific version of JQuery, then this should be included into the module requirements. If the Drupal module system is to work, it makes no sense to go rooting around in other modules when one that proclaims to accomplish a function is not able to because of another. If the module does not work with other modules, the developer has a mandate to figure out why so that it will work, or state that it will not work with other modules in my view. This being said, since the Conditional Fields module is based on JQuery, it seems to reason that ensuring that it works as advertised with JQuery would be of paramount importance.

In the meantime, I am working on numerous other similar issues with other modules. Drupal is geared specifically towards content as data and not data as data, hence, all of the fields modules available. Content alone works fine for a simple website, but not so good for portals that require workflow based on data in fields.

Amongst all of the other things on my plate, I am looking at the CF module to see if I can determine what is happening with this problem. If I come upon anything, I will let everyone know.

lunk_rat’s picture

I can confirm this bug. Only the last added dependee/dependent value pair works.

I tried on jQuery 1.5, 1.7, and 1.8. Same behavior with all of them.

This completely defeats the feature.

pt7481’s picture

Confirming this bug as well. As a workaround, I'm going with the "Any of these values (OR)..." approach outlined in comment #5.

attisan’s picture

same here - this IS a major issue

Jibus’s picture

I had this problem too when using "Any of these values (OR)..." option.

Setting jQuery 1.5 on administration page (thanks to jQuery Update) resolves the issue.

dxkernel’s picture

#13, #19 thanks, problem solved. 2 days without sleep trying to figure out this bug. Thanks ;)

Valera Tumash’s picture

#13, #19 isn't the best solution for my case (big internet shop using Drupal Commerce module). Many jQuery expressions stopped working after changing the jQuery version from 1.7 to 1.5. Updating to 7.x-3.0-alpha1+12-dev hasn't worked either. The only salvation is to use Regular Expression:
for OR:
it will be:

It helped me in my case.

xRoR’s picture


change this as row 556 in file conditional_fields.module:

      // Add the $state into the correct logic group in $states.
      foreach ($state as $key => $constraints) {
        if (empty($states[$key][$options['grouping']])) {
          $states[$key][$options['grouping']] = $constraints;
        else {
          $states[$key][$options['grouping']] = array_merge($states[$key][$options['grouping']], $constraints);

to this:

      // Add the $state into the correct logic group in $states.
      foreach ($state as $key => $constraints) {
        if (empty($states[$key][$options['grouping']])) {
          foreach ($constraints as $c_key => $value) {
	      	$constraints[$c_key][] = $value;
          $states[$key][$options['grouping']] = $constraints;
        else {
          foreach ($constraints as $c_key => $value) {
	      	$constraints[$c_key][] = $value;
          $states[$key][$options['grouping']] = array_merge_recursive($states[$key][$options['grouping']], $constraints);
draxxdk’s picture

Thanks #22. Your solution worked perfectly. Tried every solution posted here, but none of them worked in my scenario, other than yours.

There is just one small "problem". Drupal dont like $$behavior. it will show an notice message for that. Just change it to $behavior and it will be happy.

MaxMendez’s picture

Thanks #22. This solution worked perfectly for my problem.

mas0h’s picture

Downgrading JQuery to 1.5 with "Any of these values (OR)..." option worked for me, but we need to fix it with JQuery 1.7.

MaxMendez’s picture

Hi mas0h, I use jquery_update dev version with jquery 1.7 and work perfectly, try with jquery_update-dev

isimgt’s picture

Thanks #22 worked for me!! ^^

Todd Young’s picture

Confirming #22 worked for me as well, with all versions of jQuery and stable release of jQuery Update.

brogdawg’s picture

Anyone have success with using regular expressions like #21 suggests in IE? Worked for me in every other browser but IE. I gave #22 a try but it just disabled conditional fields for me altogether regardless if I used regular expressions or "Any of these values (OR).."

brogdawg’s picture

Additionally, if the "Any of these values (OR)... option worked with jquery 1.7 I could use that. I can't use jquery 1.5 because the fields are presented in a ctools modal popup form that is filled out by the user which requires 1.7 to function (either that or bootstrap requires 1.7).

kopeboy’s picture

Version: 7.x-3.x-dev » 7.x-3.0-alpha1

Can we include the #22 solution in a patch and a stable release?? This issue started 2 years ago, is Critical, and still not fixed (on a module with 35k installs).. wtf?!

I used the raw values list to fix, but please, at least mention the problem (and the workaround) in the module page until it's not fixed. Wasted 3 hours..

draenen’s picture

Version: 7.x-3.0-alpha1 » 7.x-3.x-dev
Status: Active » Needs review
789 bytes
PASSED: [[SimpleTest]]: [MySQL] 160 pass(es). View

Here is a patch with a simplified version of the code in #22

juagarc4’s picture

Patch #32 works for me.

MaskOta’s picture

Patch on #32 worked for me aswell


mooru’s picture

Thank you so much. Patch #32 worked

darrenthomas888’s picture

Patch #32 got me half ways there.

In my condition,

Dependent Z is filled with a value "foo" when dependee A has value "X"
Dependent Z is filled with a value "bar" when dependee A has value "Y"

if the filled value was constant, patch 32 would do the trick. The code does not take into consideration a difference in filled value result. It will choose the fill value of the last line inserted.

beautifulmind’s picture

Patch #32 works perfectly. This should be committed to the module ASAP.

@draenen Thank you for sharing/fixing this.


stefan.r’s picture

Status: Needs review » Reviewed & tested by the community

This seems to work great!

  • peterpoe committed cc5c0e3 on 7.x-3.x authored by draenen
    Issue #1637466 by draenen: Dependent field is not acted upon with...
peterpoe’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks!

Status: Fixed » Closed (fixed)

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

simonbcfa’s picture

Sorry but I have tried these patches (#22 and #32) and updated my code.
Tried different settings in CF as well as jQuery updater and I still cant get this to work

Basic scenario is to fill a text field with a specific value based on select list selection.

This is my code in the latest update for conditional_fields.module (code in question)

      // Add the $state into the correct logic group in $states.
      foreach ($state as $key => $constraints) {
        foreach ($constraints as $selector => $constraint) {
          // Add the constraint in an array to avoid overwriting other
          // dependencies' states with the same selector.
          $states[$key][$options['grouping']][$selector][] = $constraint;

Any help is greatly appreciated

jprstoney’s picture

#22 worked a treat! Many thanks.

Miguel Andrade’s picture

#22 worked for me. tnx

feelcreative’s picture

Echoing #36 this is NOT resolved. @darrenthomas888 did you find a workaround for this?


pallavi_sugandhi’s picture

Thanks xRoR
#22 worked for me.