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.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

amogiz’s picture

Subscribe !

drupov’s picture

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

Thanks!

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
StatusFileSize
new583 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.

scotwith1t’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: Add basic Field Group support for ANDing conditions

On second thought, maybe we should consider this as a duplicate of #1161314: Add basic Field Group support for ANDing conditions (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: Add basic Field Group support for ANDing conditions

roflcopterDorrie’s picture

StatusFileSize
new817 bytes

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

jo66’s picture

Already old topic but in my case I had to change this line
var $wrapper = $(e.target).closest('.fieldset-wrapper');
to
var $wrapper = $(e.target).parents('.fieldset-wrapper');
in @anrikun patch for it to work correctly (date with end date was not displaying inside my groupfield)
Hope it can helps someone

aram.gevorgyan’s picture

StatusFileSize
new1.1 KB
new1.1 KB

I changed last patch by checking if there are any visible children except fieldset description

j.lucky made their first commit to this issue’s fork.