I have a field collection (B) that is set within another field collection (A). I am trying to toggle the visibility of B using another field that is also in A. I have set up an appropriate dependency but toggling the field has no discernable impact on the field collection.
I have disabled all other modules to check for compatibility issues but this does not improve the situation. I am able to get the desired functionality within a field collection if both the dependent and dependee are fields. But not when the dependent is a field collection and the dependee is a field. I am also able to get the desired functionality if i move field collection B and the dependee field outside of their parent field collection and into the top level of the content type. It is only when i try to do this within another field collection that i am experiencing the above behavior.
I am not super familiar with conditional fields but if someone could point me in the right direction i would be more than willing to look into this.
Comment | File | Size | Author |
---|---|---|---|
#23 | conditional_fields-fix_for_collections_12.patch | 1.04 KB | kenorb |
#19 | conditional_fields-fix_for_collections_19.patch | 1.07 KB | ocastle |
Comments
Comment #1
k.dani CreditAttribution: k.dani commentedSame problem...
Comment #2
liquidcms CreditAttribution: liquidcms commentedi have same issue.
project i am on will fund getting this to work if anyone wants to tackle it; or will look at it myself when i get a chance.
Comment #3
pirog CreditAttribution: pirog commented@liquidcms
we have some extra bandwidth and would be more than willing to tackle the issue if you could get some fundtion for it!
Comment #4
liquidcms CreditAttribution: liquidcms commented@pirog contact me at peter@liquidcms.ca
Comment #5
liquidcms CreditAttribution: liquidcms commentedstarting to dig into this a little and right off the bat i see issue appears to be that in conditional_fields_form_after_build() the dependency info is looked at for each field that has been assigned as dependent; and for my field there is no dependee info set; so function exits - and no JS is loaded.
Comment #6
liquidcms CreditAttribution: liquidcms commentedit is this code that fails for the dependee field (field collection trying to be made invisible based on simple list field):
which returns the wrong values to pass for this:
Comment #7
liquidcms CreditAttribution: liquidcms commentedand sure enough, if i statically force in the right values; everything works fine.. :) so just need to figure out the additional cases required for that clause to pull the correct $entity_type and $bundle values.
Comment #8
liquidcms CreditAttribution: liquidcms commentedi am sure this isn't the proper patch as i likely took a few liberties with my specific application; but should be a decent starting point.
Comment #9
liquidcms CreditAttribution: liquidcms commentedmy guess is my new test case is different than the one that i designed the patch above for; as it doesn't work in this case.
i switched around the 2 elseif clauses and it now works for my current case; but not sure it would still work for the case i originally had; my guess is it does.
Comment #10
semiaddict CreditAttribution: semiaddict commentedThe patch in #8 works great for me.
Thank you.
Comment #11
semiaddict CreditAttribution: semiaddict commentedI ended up having to make a slight change in #8's patch to make it work with my setting, but I think this new patch should work for most if not all settings.
Comment #12
MO-2 CreditAttribution: MO-2 commentedPatch in #11 worked - Jumping for joy; albeit more baldly now!
UPDATE
Please help roll this dual patch to a release: https://drupal.org/node/2088101
Comment #12.0
MO-2 CreditAttribution: MO-2 commenteda little extra precision
Comment #13
Jody LynnPatch in 11 works for me.
There is still a slight problem in that if you have required fields that are triggered by conditionals, and you add another field collection, you can end up with two 'required' asterisks on your fields.
Comment #14
kenorb CreditAttribution: kenorb commentedComment #15
ocastle CreditAttribution: ocastle commentedPatch #11 also works for me. Thanks!
Comment #16
kenorb CreditAttribution: kenorb commentedComment #19
ocastle CreditAttribution: ocastle commentedReformatted Patch to be correct format and diff'd against dev branch
Comment #20
ocastle CreditAttribution: ocastle commentedComment #21
mdelpozo CreditAttribution: mdelpozo commentedpatch #19 worked for me
Comment #22
Marfio CreditAttribution: Marfio commentedWorking for me
As said #12 both patches resolves many problems for Field Collection anf Conditional Fields.
Thank you very much!!!
Comment #23
kenorb CreditAttribution: kenorb commentedUpdating patch offsets against the latest dev.
Comment #24
jschrab CreditAttribution: jschrab commentedGiven that the patch in #19 is marked as "Reviewed & tested by the community", what more is needed to get this patch into dev?
Comment #25
peterpoe CreditAttribution: peterpoe as a volunteer commentedDuplicate of #1464950: Support for multiple "Field collection" and "Multifield" fields
Comment #26
peterpoe CreditAttribution: peterpoe as a volunteer commented