Hide fieldset if empty

mshaver - February 7, 2008 - 23:36
Project:Workflow Fields
Version:5.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:kratib
Status:active
Description

Is there a way to hide a fieldset for a role if all the fields within that fieldset are hidden for that role? It may seem trivial, but when users are viewing or editing a node and an empty fieldset is visable, it is rather confusing. Where would I look for this in the code and does it refer more to CCK then to worflow_fields? Thanks

#1

kratib - February 15, 2008 - 17:32

Thanks for your suggestion.

If you want to take a look at the code yourself, the function workflow_fields_node_form_alter() is the one in charge of showing the node form with the altered fields, and workflow_fields_nodeapi() handles the node view page.

#2

mshaver - February 26, 2008 - 17:10

This actually already works for the node display, as the "fieldgroup.module" weight is set to 9, after the "workflow_fields.module" is called and has the hook _nodeapi() that hides the group if the fields are empty or not accessible?

Where it doesn't work is on node edit, the group is still visible if all fields are not accessible within the group for that role. The fieldgroup_form_alter() seems like it would take care of this as well, but it doesn't for some reason?

#3

kratib - February 26, 2008 - 20:21
Category:feature request» bug report
Assigned to:Anonymous» kratib

I confirmed that this is indeed a bug when fields are inside a fieldset. The fields are not found by workflow_fields which removes them from the database, thinking they've been deleted from the content type.

#4

deekayen - July 17, 2008 - 12:27

Also related if not duplicate: http://drupal.org/node/159099

#5

deekayen - July 17, 2008 - 20:25

There might be an answer to this in 6.x: http://drupal.org/node/277101

#6

nath - August 6, 2008 - 15:05

Any solution for the 5.x version?

#7

kratib - August 6, 2008 - 21:19

That's not high on my priority list, especially that D6 is maturing. You're welcome to submit a patch :-)

I'll check whether this bug also affects D6 since I'm not sure it is just a problem of rendering or a deeper one.

#8

adnansyed - August 16, 2008 - 05:23

I also want to remove an empty Group fieldset box at the bottom of my registration form even though I have selected all groups to be private and made sure that the option "display on registration form" is unchecked.

Does anybody know how to fix this?

 
 

Drupal is a registered trademark of Dries Buytaert.