Last updated February 21, 2009. Created on January 30, 2009.
Edited by eigentor, ultimateboy. Log in to edit this page.

Problem

There are a lot of settings on a Form which makes it too long. User is to be presented with a manageable amount of items he can scan in one glance.

Solution

Subsets of the settings are put under a collapsible Fieldset which is collapsed by default.

Use when

The items that are grouped into a Collapsible Fieldset must be a logical group. In our Example, which is taken from the content type settings form they affect the default fields (title and body) of a submission form.

Also these Fieldsets only make sense, when the form has too many items without them, In very short forms they should not be collapsed.

How

Label The fieldset's label should, in most cases, be a short description of what is contained in within the fieldset such as "Locale settings". The first character of the first word should be capitalized and no additional capitalization should be used (unless a proper noun or acronym is used). Try to avoid incomplete thoughts such as "Allow comments when" as that leads to confusion when the fieldset is collapsed. There should be no ending punctuation.

Collapsible A fieldset should only be un-collapsible if it contains required form elements vital to the submission of form. All other fieldsets should be collapsible by the end-user. By default, fieldsets not directly associated with the form should be collapsed. Required fields should never be included in a fieldset which is collapsed by default. For example, when creating a new content type, the required fields are "name" and "type". These are enclosed in a fieldset which defaults to open and is not collapsible because it contains fields vital to the creation of the content type. On the same form, the comment settings fieldset is collapsed by default on the content type form because comments are not directly associated with creating a content type.

Example The following fieldset was taken from the 'Add vocabulary' tab from within the taxonomy module. It's title is descriptive, and the contained form-items are all directly associated with one another. By default, this fieldset is open due to the fact that a content type must be selected in order to taxonomy to be used.
Fieldset example - taxonomy content type selection

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

iantresman’s picture

It's worth mentioning that CCK Field groups are collapsible (you need to enable the CCK Fieldgroup module). See also the modules: (a) Collapsible Text (b) Collapsiblock (c) D7 CCK Field group

LWVMD’s picture

Thank you for posting this info; I've been searching for a "field set" module or wondering if I needed to turn something else on. Once I realized I should be looking for "Field Group" module, it was easy to fix.