[drupal-devel] [feature] Form groups should be collapsible

tangent drupal-devel at drupal.org
Wed Jan 26 03:46:52 UTC 2005

 Project:      Drupal
 Version:      4.5.2
 Component:    base system
 Category:     feature requests
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  tangent
 Updated by:   tangent
 Status:       patch
 Attachment:   http://drupal.org/files/issues/fieldset_test.html (3.41 KB)

Here's a stand-alone test page so you can see what the functionality
would be like. Please report any issues with specific browsers by
attaching your user-agent string or a description of your browser and
the issue. Screenshots are welcome.


Previous comments:

January 25, 2005 - 22:42 : tangent

Attachment: http://drupal.org/files/issues/collapsible_formgroups.patch (2.8 KB)

With all the talk of form reorganization and with the latest attempts at
coding a solution, I thought I'd step up and contribute my solution. It
is a quick development that I just threw together and it will probably
need to be expanded to support more options, but it works and it has
zero impact on existing code other than a small change to
form_groups(). I've added an optional boolean parameter called
"collapsed" so that modules can specify if the group should be
initially collapsed or not.

Known issues:
1. Styling the collapsed forms to look the same or even just good in
every browser may prove troublesome. It looks fine in Mozilla/Firefox
but the legend jumps around a bit in IE. I'm not terribly concerned
about that at the moment though.

2. Required fields are not handled so a collapsed fieldset *could*
contain a required field. This will need to be dealt with before this
is a real solution, in my opinion. The difficulty lies in the fact that
required fields are not labeled (in the markup) as such, other than by
adding an extran span. Maybe we should think about adding a "required"
attribute to required fields.

I'm attaching the patch (against HEAD) now and will attach the
javascript file shortly as well as a test page so you can see the

As an aside, I'm setting this issue to patch status since that seems to
be the process used around here. However, I think that generally an
issue should ONLY be set to patch status if the attached file is worthy
of being commited. Please correct me if I have misunderstood.


January 25, 2005 - 22:44 : tangent

Attachment: http://drupal.org/files/issues/drupal.js (1.68 KB)

Here's the (new) drupal.js file. Note that don't necessarily think the
functions included in it need to be loaded for every request. If more
javascript is added, it should probably be broken up into separate
pieces that can be sourced as need.

View: http://drupal.org/node/16204
Edit: http://drupal.org/project/comments/add/16204

More information about the drupal-devel mailing list