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 field_category OR 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.

Files: 

Comments

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.

Component:User interface» Code
Priority:Normal» Critical
StatusFileSize
new1.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

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

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.

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 ?

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)

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.

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.;

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...

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

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.

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

@hollyfox,

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

Regards

@pmichelazzo

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

Cheers

StatusFileSize
new32.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.

Thanks.

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.

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.

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

same here - this IS a major issue

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.

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

#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:
1
2
3
4
it will be:
(1|2|3|4)

It helped me in my case.

Workaround:

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;
  unset($constraints[$c_key]['value']);
          }
          $states[$key][$options['grouping']] = $constraints;
        }
        else {
          foreach ($constraints as $c_key => $value) {
      $constraints[$c_key][] = $value;
  unset($constraints[$c_key]['value']);
          }
          $states[$key][$options['grouping']] = array_merge_recursive($states[$key][$options['grouping']], $constraints);
        }
      }

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.

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

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.

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

Thanks #22 worked for me!! ^^