While the ability to have callapsed areas in long forms is generally very good, I find that novice users are often confused because they do not see their 'options' immediately visible. This is particularly confusing if a 'required' field is initially hidden by the 'collapsed' area.

Is there a way to set specfic areas of a content creation form to be 'expanded'?

Thanks.

Comments

siteformer’s picture

You can comment out the css-selector 'html.js fieldset.collapsed *' in drupal.css. This selector sets the collapsed areas to 'display: none'.

nedjo’s picture

In a module, you can use a form_alter hook to reset the particular value. You need to know the id of the form and the name of the field you're altering.

For example, if you wished to set the "Authoring information" fieldset to expanded for the node/add/page form, you would do something like:


function modulename_form_alter($form_id, &$form) {
  if ($form_id == 'page_node_form') {
    $form['author']['#collapsed'] = FALSE;
  }
}

gmak’s picture

The obvious follow-up questions (at least from me) are:

- how do I find out the form id?
- where would I add this function (which file do I alter)?

Thanks.

nedjo’s picture

For form_id, look at the HTML source of the rendered form and look for an input with parameters that look like this:

type="hidden" name="edit[form_id]" value="book_node_form"

As for where to add this, use a custom module.

Or, if you just want to hack in a change, find the module that generates your form and make your edit directly to the form element, changing the '#collapsed' value to FALSE.

bill18’s picture

Thanks. It worked. But it's better to have a setting function to let webmasters choose whether a field should be expanded or not. So is the sequence of fields.