Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Hello,
I have one question. Does this module work with image fields? I can not get it run.
I want that one imagefield is hide if another has a value.
Thanks for any help!
Best regards
Frank
Comment | File | Size | Author |
---|---|---|---|
#11 | conditional_fields-image_field_dependee_value-1704090-9.png | 19.1 KB | chrisgross |
#9 | conditional_fields-image_field_dependee_value-1704090-9.png | 18.83 KB | chrisgross |
Comments
Comment #1
peterpoe CreditAttribution: peterpoe commentedDependent image fields work. You can read the new documentation to check that you got everything right: http://drupal.org/node/1704126
Comment #2
fraweg CreditAttribution: fraweg commentedThanks a lot for your fast answer!
Best regards
Frank
Comment #4
jfarry CreditAttribution: jfarry commentedHi Guys :)
I'm experiencing a bit of a problem between Conditional Fields and Image Field uploads in Drupal 7 as well. I've read the guide and have tried quite a few different permutations of options, but so far can't seem to achieve what I'm after.
I have two fields, one is an embedded media (file) field and an Image field. I want one to disappear when the other is filled. This works fine if I start to fill out the embedded medial field, the Image field disappears no problems, but if I upload an image through the Image field, the embedded media field doesn't disappear. I've tried setting the selectors to various form elements for the image field as well, but with undesirable results. If I set the selector to the image field Upload button, the embedded media field is constantly hidden. If I set the selector to any other form element of the image field, the embedded media field never disappears. I've also tried setting the dependee action to Focus and targetted the Submit button with the selector, but that doesn't remove the embedded media field either.
One more thing, if I set the image field to disappear and be emptied when the embedded media field is filled, the image field itself is not emptied, but the image upload button has its text removed. This shouldn't be a problem when I can get the other field to disappear, just thought I'd add it as a side note.
I feel like I'm missing something small and stupid, but I've changed so many thing now that I don't know what could be left, lol.
Thank you for your time :)
Josh
Comment #5
liquidcms CreditAttribution: liquidcms commentedi am also pretty sure that this does not work with image fields as the Dependee: http://screencast.com/t/FqtLfeJDM5YN
Comment #6
Jason Dean CreditAttribution: Jason Dean commentedI'm also unable to use an image field as a dependee. The dependent field shows regardless.
Comment #7
alpho81 CreditAttribution: alpho81 commentedSame problem here. I'm also unable to use an image field as a dependee.
Comment #8
fonant CreditAttribution: fonant commentedI have a need to only show a field if there is one or more images uploaded into a multiple-value file / image field. I can't get it to work, the dependent field is always shown, even when no images have been uploaded. Would be nice if the "Empty" test worked for a multiple-value file field with no files.
Comment #9
chrisgross CreditAttribution: chrisgross commentedFor anyone still struggling with this, yes this is possible without a patch. The problem seems to be that the image field is not correctly targeting the DOM object that is given a value when an image is chosen. To do this, we simply change the jQuery selector and make sure that we are checking the value attribute of that element, remembering that when the field is empty, the value is "0".
Configure the condition like this:
And the Advanced Context Settings like so:
For the selector, I've chosen a class that matches the class of the field element/DOM object that contains the value. This will change depending on the name of your field, but you can use any variant of selector that matches this element. If you are only using one image field per bundle, you can probably even get away with just '.fid' instead. I tried using the language and key tokens to select the name attribute of the element, but I couldn't get it to work.
The above example is assuming the form state context is set to "visible". You should be able to make this work in other configurations, but this is the general process.
Comment #10
chrisgross CreditAttribution: chrisgross commentedComment #11
chrisgross CreditAttribution: chrisgross commentedJust updating the file in #9 to switch the logic on the fid selector. This value will actually match the fid, so it just needs to NOT be 0. There is another hidden field with no unique class that seems to only store a 1 or a 0, but as stated in comment #9, I have not been able to get this name selector to work with the tokens. If anyone else has better luck, let me know, but this solution still works.
Comment #12
cotillardq CreditAttribution: cotillardq commentedThe only way I was able to make it work was by using the name value:
input[name='field_hero_image_lg[und][0][fid]'] in the Advanced Context Settings
Comment #13
ray17n CreditAttribution: ray17n commented#12 worked for me, using a similar value, thanks.
Comment #14
bpadaria CreditAttribution: bpadaria commented#12 worked for me as well with combination of #11
Thanks for sharing!!
Comment #15
yogeshmpawarI my case i have a multiple paragraph layers in which i have to show/hide one radio button field on image upload.
how can i achieve this kind of functionality @chrisgross & @cotillardq
Comment #16
fpap CreditAttribution: fpap commented#12 worked for me too, thank you!!!