I cannot get this to work inside fieldsets; there appears to be no way to do this.

Comments

gribnif’s picture

Status: Active » Closed (fixed)

It just requires a little bit of trickery. Essentially, a fieldset needs to have the default theme, so instead you put your content within a wrapper that has the form_panel theme. Here is a fieldset with two checkboxes, wrapped inside a table:

$form['fieldset1'] = array(
  '#type' => 'fieldset',
  '#title' => t('Fieldset'),
  '#collapsible' => TRUE,
  '#collapsed' => FALSE,
);

$form['fieldset1']['wrapper'] = array(
  '#theme' => 'form_panel_table',
);

$form['fieldset1']['wrapper']['checkbox1'] = array(
  '#type' => 'checkbox',
  '#title' => t('Checkbox 1'),
  '#weight' => 2001,
);

$form['fieldset1']['wrapper']['checkbox2'] = array(
  '#type' => 'checkbox',
  '#title' => t('Checkbox 2'),
  '#weight' => 2002,
);

return $form;