1

I have an admin module with an edit form, that has two fieldsets. On opening the page both fieldset are open by default and there is no option for the user to close either of them. How do I have one closed by default when the page is rendered?

my code

class Namespace_Module_Block_Adminhtml_Module_Edit_Form    
    extends Mage_Adminhtml_Block_Widget_Form

$fieldset = $form->addFieldset('base_fieldset', array(
        'legend'    => $this->__('Module information'),
        'class'     => 'fieldset-wide',
    ));

    //set the container that holds form information
    $fieldset2 = $form->addFieldset('base_fieldset2', array(
        'legend'    => $this->__('A pointless second blue bar'),
        'class'     => 'fieldset-wide',
    ));

...additional code to create fields...

I looked into Mage_Adminhtml_Block_System_Config_Form_Fieldset and found _addExtraJs() and _getCollapseState() but this does not seem to be extended by Mage_Adminhtml_Block_Widget_Form and im guessing using instaniating that object is not the best way to achieve my goal

2

Did you try expanded? As in the system.xml?

$fieldset = $form->addFieldset('base_fieldset', array(
    'legend'    => $this->__('Module information'),
    'class'     => 'fieldset-wide',
    'expanded'  => true, // open
));

//set the container that holds form information
$fieldset2 = $form->addFieldset('base_fieldset2', array(
    'legend'    => $this->__('A pointless second blue bar'),
    'class'     => 'fieldset-wide',
    'expanded'  => false, // closed
));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.