First of all, great module - thanks for maintaining it!

I have two horizontal tabs named Saturday and Sunday used for adding/editing a node form. In the content type definition, Saturday defaults to open and Sunday defaults to closed. I would like to dynamically close Saturday and open Sunday.

From, I thought I could use hook_field_group_pre_render_alter like so:

function lcog_bcc_field_group_pre_render_alter(&$element, $group, &$form) {
if ($group->format_type == 'htab') { //only change HTAB item
if ($element['#id']=='node_commute_form_group_saturday') {
if ($element['#id']=='node_commute_form_group_sunday') {

but Saturday continued to show up as the open tab.

After dumping $element, $group and $form and looking for all other places where the tab states might be set, I added the following to the Saturday part of the code above:

$element['#collapsed'] = TRUE;
$group->collapsed = TRUE;
$group->classes .= 'collapsed ';

and this to Sunday:

$element['#collapsed'] = FALSE;
$group->collapsed = FALSE;
$group->classes=str_replace('collapsed ', '', $group->classes);

but it did not help - Saturday is still showing as the default tab on the form.

Of course, I've cleared my cache every time. . .

I'm sure I'm just missing something obvious. Any ideas? Thanks so much. . .



prinds’s picture

oops - sorry, posted in the wrong place..

haggins’s picture

I am setting #default_tab to the corresonding fieldsets ID in a custom $form array (i.e. '#default_tab' => 'edit-section-pricecategories-wrapper-content-types-2'). However, this setting seems to be ignored.

Did anyone get this working?

sylwester’s picture

the only way that I managed to get that working is by adding

//add inline javascript
           window.location = "#'
, 'inline');

in hook_form_alter, where $opentab is ID of the horizontal tab set in structure -> content type -> manage fields.
Not pretty but it works.

fabioneves’s picture

Anyone managed to do this? I also want to set a tab dynamically.