I wish to use fieldsets within my node module's hook_form to organize sets of related form fields for that node/content type, but Drupal insists on placing any fieldset I generate under it's own "Advanced options" collapsible fieldset, which is obviously not where I want it to be.

Really frustrating... anyone know how to modify this behavior?

Comments

emjayess’s picture

It's as if Drupal assumes any form fields contained within a fieldset must be "Advanced options", which seems like a really silly assumption to make.

What am I missing here?

--
Matthew J. Sorenson (emjayess)
d.o. | g.d.o.

heine’s picture

We are missing your code.

Please paste your implementation of hook_form between <?php ?> or <code> </code> tags.

--
The Manual | Troubleshooting FAQ | Tips for posting | How to report a security issue.

emjayess’s picture

With something like this, the declared fieldset gets tucked away in "Advanced options" (e.g. along with 'Authoring info', 'Publishing options', and the like).

I don't want these considered advanced options, I want them to be considered normal, standard content fields -- yet grouped via fieldset.


/**
 * hook_form
 */
function stuff_form($node) {
  $type = node_get_types('type', $node);
  
  $form['title'] = array(
   '#type' => 'textfield',
   '#title' => check_plain($type->title_label),
   '#required' => TRUE,
   '#default_value' => $node->title
  );

  // declaring the fieldset
  $form['my_fieldset'] = array(
   '#type' => 'fieldset', 
   '#title' => t('My Fieldset')
  );

  // group'd fields in the fieldset
  $form['my_fieldset']['my_select'] = array(
   '#type' => 'select',
   '#title' => t('My Select Options'),
   '#options' => array('opt 1', 'opt 2', 'opt 3'),
   '#required' => TRUE
  );
  $form['my_fieldset']['my_text'] = array(
   '#type' => 'textarea',
   '#title' => t('My Text'),
  );
  return $form;
}

--
Matthew J. Sorenson (emjayess)
d.o. | g.d.o.

newtonik’s picture

Hi I have the same issue, did you fix it? If you did please let me know. Thanks.

emjayess’s picture

I actually just figured this out the other day -- by accident almost -- randomly checking thru some configurations (that weren't originally set by me)...

turned out to be a setting in the Form Filter configuration (admin/settings/formfilter)... Simplify Node Form set to enabled was the culprit, from the setting's own description...

and then putting all the fieldsets in one Advanced options fieldset.

HTH

--
Matthew J. Sorenson (emjayess)
d.o. | g.d.o.