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.
Comment | File | Size | Author |
---|---|---|---|
#32 | dependent_field_multiple_logic_grouping-1637466-32.patch | 789 bytes | draenen |
#14 | conditional.png | 32.58 KB | pmichelazzo |
#2 | multiple_dependency_bug.zip | 1.48 KB | drillprp |
Comments
Comment #1
Sk1Zy CreditAttribution: Sk1Zy commentedGona 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.
Comment #2
drillprp CreditAttribution: drillprp commentedI 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
Comment #3
pfhsmj0 CreditAttribution: pfhsmj0 commentedI 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.
Comment #4
pacome CreditAttribution: pacome commentedSame 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 ?
Comment #5
_ Mazzhe CreditAttribution: _ Mazzhe commentedI had the same issue. I don't know why it doesn't work, but I know an other way to do the same thing :
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 :
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)
Comment #6
dafederSame issue here. Does work if I use "is one of" and enter the values (tids in my case) manuall, but this is not ideal.
Comment #7
hefox CreditAttribution: hefox commentedLooked 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.;
Comment #8
byronveale CreditAttribution: byronveale commentedIn 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...
Comment #9
pmichelazzoI have the same problem. One select box with 4 or 5 options just change the dependent field in the last option.
Comment #10
hollyfox CreditAttribution: hollyfox commentedI 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.
Comment #11
dafeder#10 did you try using "is one of" and entering manual ids?
Comment #12
pmichelazzo@hollyfox,
Any success with this issue? I've trying to find a solution but without success.
Regards
Comment #13
rinasek CreditAttribution: rinasek commented@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
Comment #14
pmichelazzo@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.
Comment #15
hollyfox CreditAttribution: hollyfox commentedI 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.
Comment #16
lunk rat CreditAttribution: lunk rat commentedI 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.
Comment #17
pt7481 CreditAttribution: pt7481 commentedConfirming this bug as well. As a workaround, I'm going with the "Any of these values (OR)..." approach outlined in comment #5.
Comment #18
attisansame here - this IS a major issue
Comment #19
Jibus CreditAttribution: Jibus commentedI 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.
Comment #20
dxkernel CreditAttribution: dxkernel commented#13, #19 thanks, problem solved. 2 days without sleep trying to figure out this bug. Thanks ;)
Comment #21
Valera Tumash CreditAttribution: Valera Tumash commented#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.
Comment #22
xRoR CreditAttribution: xRoR commentedWorkaround:
change this as row 556 in file conditional_fields.module:
to this:
Comment #23
draxxdk CreditAttribution: draxxdk commentedThanks #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.
Comment #24
MaxMendez CreditAttribution: MaxMendez commentedThanks #22. This solution worked perfectly for my problem.
Comment #25
mas0h CreditAttribution: mas0h commentedDowngrading JQuery to 1.5 with "Any of these values (OR)..." option worked for me, but we need to fix it with JQuery 1.7.
Comment #26
MaxMendez CreditAttribution: MaxMendez commentedHi mas0h, I use jquery_update dev version with jquery 1.7 and work perfectly, try with jquery_update-dev
Comment #27
isimgt CreditAttribution: isimgt commentedThanks #22 worked for me!! ^^
Comment #28
Todd Young CreditAttribution: Todd Young commentedConfirming #22 worked for me as well, with all versions of jQuery and stable release of jQuery Update.
Comment #29
brogdawg CreditAttribution: brogdawg commentedAnyone 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).."
Comment #30
brogdawg CreditAttribution: brogdawg commentedAdditionally, 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).
Comment #31
kopeboy CreditAttribution: kopeboy commentedCan 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..
Comment #32
draenen CreditAttribution: draenen at Monarch Digital commentedHere is a patch with a simplified version of the code in #22
Comment #33
juagarc4 CreditAttribution: juagarc4 commentedPatch #32 works for me.
Comment #34
MaskOta CreditAttribution: MaskOta commentedPatch on #32 worked for me aswell
Thanks
Comment #35
mooru CreditAttribution: mooru commentedThank you so much. Patch #32 worked
Comment #36
darrenthomas888 CreditAttribution: darrenthomas888 commentedPatch #32 got me half ways there.
In my condition,
Dependent Z is filled with a value "foo" when dependee A has value "X"
AND
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.
Comment #37
beautifulmindPatch #32 works perfectly. This should be committed to the module ASAP.
@draenen Thank you for sharing/fixing this.
Regards.
Comment #38
stefan.r CreditAttribution: stefan.r commentedThis seems to work great!
Comment #40
peterpoe CreditAttribution: peterpoe as a volunteer commentedCommitted, thanks!
Comment #42
simonbcfa CreditAttribution: simonbcfa commentedSorry 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)
Any help is greatly appreciated
Comment #43
jprstoney CreditAttribution: jprstoney commented#22 worked a treat! Many thanks.
Comment #44
Miguel Andrade CreditAttribution: Miguel Andrade commented#22 worked for me. tnx
Comment #45
feelcreative CreditAttribution: feelcreative as a volunteer commentedEchoing #36 this is NOT resolved. @darrenthomas888 did you find a workaround for this?
C
Comment #46
pallavi_sugandhi CreditAttribution: pallavi_sugandhi commentedThanks xRoR
#22 worked for me.
Comment #47
Brandon_ST CreditAttribution: Brandon_ST commentedPatch #32 worked like a charm! Thanks @draenen!
Comment #48
HansKuiters CreditAttribution: HansKuiters commented#22 and/or patch #32 works fine. Thanks!