diff --git a/misc/vertical-tabs.js b/misc/vertical-tabs.js index 82dcd2c..0ebfe09 100644 --- a/misc/vertical-tabs.js +++ b/misc/vertical-tabs.js @@ -38,6 +38,25 @@ Drupal.behaviors.verticalTabs = { $(this) .removeClass('collapsible collapsed') .addClass('vertical-tabs-pane') + // Override the default state:visible handler. + .bind('state:visible', function(e) { + if (e.target == this && e.trigger) { + // Get the id of the fieldset. + var id = $(e.target).closest('.form-item, .form-submit, .form-wrapper').attr('id'); + if (id) { + // Get the corresponding vertical_tab button. + // Hide or show that instead of the fieldset. + if (!e.value) { + vertical_tab.tabHide().updateSummary(); + } + else if(e.value) { + vertical_tab.tabShow().updateSummary(); + } + // Don't bubble this up to the default handler. + return false; + } + } + }) .data('verticalTab', vertical_tab); if (this.id == focusID) { tab_focus = $(this);