Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When editing/adding an entity that contains conditional fields via an Inline Entity Form, the conditional_fields.js is not included, disabling its functionality.
Comment | File | Size | Author |
---|---|---|---|
#14 | IEF_compatibility-2193025-14.patch | 627 bytes | mansspams |
#9 | conditional_fields-IEF_compatibility-2193025-#8.patch | 627 bytes | mihai_brb |
#7 | conditional_fields-IEF_compatibility-2193025-#7.patch | 839 bytes | mihai_brb |
#3 | jsloading-2193025-3.patch | 543 bytes | sender |
Comments
Comment #1
kaushashah CreditAttribution: kaushashah commentedEven I am facing the same issue. For administer, it is working fine but for non-admin, it doesn't show up the fields. Any solution to this?
Comment #2
kaushashah CreditAttribution: kaushashah commentedDon't know how but by granting the permission of administer url alias, fields defined under conditional states started showing up.
Comment #3
sender CreditAttribution: sender commentedHere is a patch that loads conditional_fields.js in a different way.
Inline Entity Form now picks up on the JS, and the behavior is as expected.
Note: I don't use effects for conditional fields, and I didn't change the $form['#attached']['js'] for effects.
Comment #4
zmove CreditAttribution: zmove commentedNot working for me, can't make conditional fields working with an inline entity form added entity, even with this patch applied.
Comment #5
mihai_brb CreditAttribution: mihai_brb commentedThe above patch changes the command to attach the main js file.
I made a test and forced that this file will be included on all pages but the conditions are still not working.
Isn't the problem with the next lines of code that add the effects?
Comment #6
mihai_brb CreditAttribution: mihai_brb commentedAfter further looking into this it seems that the problem is not with the fact that the main module main JS file is not loaded. As far as I see the functionality is not given by the main JS file, but by the Form API #states.
From my tests, the problem is here:
If it fails to get the entity type and bundle from the element, it will take this info from $form. In case of IEF fields, this is not correct, because the form is for the field that references the entity fields. This will lead to out of context conditional_fields_load_dependencies().
Patch is on the way.
Regards,
Mihai
Comment #7
mihai_brb CreditAttribution: mihai_brb commentedOK, in my case this fixed dependent fields triggering.
I have tested with one/multiple entity reference values and both IEF single/multiple values widget.
More info:
I have a Node, referencing products. Products have a Boolean field, triggering the visibility of another field.
Are there any other cases to be tested?
Mihai
Comment #9
mihai_brb CreditAttribution: mihai_brb commentedwops, forgot to create the diff on the module repository ...
Comment #10
yannickooWorked fine for me, thanks!
Comment #11
minorOffense CreditAttribution: minorOffense commentedWhy is it only choosing field[0] ?
Comment #12
yannickooI think it's enough to load the JavaScript once, after the necessary files have been loaded it can not break anymore :)
Comment #13
mansspams CreditAttribution: mansspams commentedAdd that in comment above lines? Its a legit question.
Comment #14
mansspams CreditAttribution: mansspams commentedReupload without # character in patch name to work on Windows drush make.
Comment #15
millerengage CreditAttribution: millerengage commented#14 works for me.
It's been 8 months. Can this be added to the release yet?
Comment #16
silurius CreditAttribution: silurius commentedThis has been ready for porting for 2 years. What's the plan?
Comment #17
Topplestack CreditAttribution: Topplestack commentedThis same problem exists for D8. I've created a ticket for it here:
https://www.drupal.org/node/2856720
Part of the issue in D8 is the removal of drupal_add_js() in favor of $form['#attached'] which doesn't seem to be working in this situation.
Comment #18
delacosta456 CreditAttribution: delacosta456 commentedhi
this is not working for commerce kikstart when using conditional field on an IEF on product variation
Comment #19
mikestar5 CreditAttribution: mikestar5 commentedI applied patches #3 and #9 and it still isn't working with a node that has several IEF fields...
Does anybody know why this is happening?
conditional_fields.js is now being loaded on IEF actions... but still unresponsive when loading more than one IEF field.
thanks
Comment #20
dqdThanks for the reports and all the hard work in here. But due to inactivity in this issue for years and because of the upcoming EOL of Drupal 7 soon I will close this issue while cleaning up the issue queue. Check the related issue top right, there is a fix to be committed soon for Drupal 8 and above.