If all the fields in a fieldset are hidden, then the fieldset itself should be hidden to rather than displaying an empty fieldset.

Would be nice to be able to select the entire Field Group. Right now have to choose each child field individually.

Members fund testing for the Drupal project. Drupal Association Learn more


amogiz’s picture

Subscribe !

drupov’s picture

+1 for that too. It would be really important to see it work.


Edit: or is it a duplicate of https://drupal.org/node/1161314 ?

vlooivlerke’s picture

This is not a duplicate, the other issue is about fieldgroup and not fieldset

I want to hide an empty fieldset

chrislabeard’s picture

Issue summary: View changes

Anyone find a solution for this?

System Lord’s picture

I, too, would like to see this fixed.

GemQueen’s picture

Me too!

jacquelynfisher’s picture

Same here. Since fieldsets are now built into Drupal, it is important to be able to hide the fieldset, whether we make the fieldset itself conditional or if we hide the fieldset when "empty" (all fields within are conditionally hidden).

anrikun’s picture

Component: Compatibility w/ other modules » Javascript
Status: Active » Needs review
583 bytes

Please try this patch that hides fieldsets unless one of their fields is visible.

Zekvyrin’s picture

Great! It works as expected for me.

Zekvyrin’s picture

Well, I guess I was too fast to answer..

This doesn't check recursively (for example it doesn't hide a group which has a "hidden" group which was hidden by this)

bobdekinder’s picture

Patch #8 works perfectly for me. https://www.drupal.org/node/1161314 would be a more cleaner solution, but for now this will do :)

wildfeed’s picture

Patch #8 is a BINGO. Spot on. Thank you anrikun!

tedstein’s picture

Patch works perfectly for the closest fieldset. However, if fieldsets are nested then the patch fails to reach the outer fieldsets.

This also breaks if there are nested fieldsets: The nested fieldsets do not reappear when the condition is triggered.

scotself’s picture

Any movement on this one? We regularly run into this and just opt to not bother putting things into a fieldset at all because of it...

knalstaaf’s picture

Status: Needs review » Needs work

Changing status (see #13).

knalstaaf’s picture

Status: Needs work » Closed (duplicate)
Related issues: +#1161314: Fieldgroup support

On second thought, maybe we should consider this as a duplicate of #1161314: Fieldgroup support (as mentionned in #11).

anrikun’s picture

All right, I've just posted a new version of my patch that should work with nested fieldsets there.
See #1161314: Fieldgroup support

roflcopterDorrie’s picture

Since #1161314: Fieldgroup support is still not working correctly, I applied this patch and found that it wasn't working for me.

:visible was always returning true, even when the element had display:none.

So I updated it to look for display:none instead.

delacosta456’s picture

thanks @anrikun and @roflcopterDorrie ...

@roflcopterDorrie your patch work correctly together with this patch https://www.drupal.org/node/2494385#comment-10708812 on my panopoly distribution 1.46