ahah and fieldset 'collapsed' state On my drupal 6 site I have the following fieldset in one of my forms ($cur_div_wrapper_name is a variable I have set to be "share_opp_with_rep_div"):

$form['add_rep_share_fieldset'] = array(
    '#type' =&gt; 'fieldset',
    '#title' =&gt; t('Share with Rep'),
    '#prefix' =&gt; '&lt;div id="' . $cur_div_wrapper_name . '"&gt;',
    '#suffix' =&gt; '&lt;/div&gt;',
    '#collapsible' =&gt; TRUE,
    '#collapsed' =&gt; TRUE,
);


As you can see, the fieldset is collapsible and has a state of collapsed by default.

Inside of this fieldset I have two selects.  One of these selects ("share_with_rep") changes it's values when the other select ("share_with_rep_region") is changed.  I utilize ahah and the ahah_helper module to make this work.

$form['add_rep_share_fieldset']['share_with_rep_region'] = array(
    '#type' =&gt; 'select',
    '#title' =&gt; t('Region'),
    '#options' =&gt; $regions_lov,
    '#default_value' =&gt; $default_share_opp_region,
    '#ahah' =&gt; array(
        'event' =&gt; 'change',
        'path' =&gt; ahah_helper_path(array('add_rep_share_fieldset')),
        'wrapper' =&gt; $cur_div_wrapper_name,
    ),
);


$regions_lov is a variable containing an array of options for this select.

$form['add_rep_share_fieldset']['share_with_rep'] = array(
    '#type' =&gt; 'select',
    '#title' =&gt; t('Sales Rep'),
    '#options' =&gt; $rep_user_lov,
    '#default_value' =&gt; $default_share_opp_rep,
);


$rep_user_lov is a variable containing an array of options for this select.

The user has to un-collapse the fieldset in order to see the two selects.  When I change the "share_with_rep_region" select the other select ("share_with_rep") changes automatically.  This works fine.  

My problem is that the fieldset does not keep it's un-collapsed state after changing the "share_with_rep_region" select, and the user has to click on the fieldset again to un-collapse it and choose a value for "share_with_rep".

Does anyone know if it's possible to pull the collapsed state of the fieldset and remember it so the user does not have to click it again to view the contents after changing the "share_with_rep_region" select?

Thank you!
I'd do something along the lines of checking the value of share_with_rep_region before defining the collapsed state of your fieldset. i.e.:

// whatever the default value of the select is before 
// the user has interacted with it in any way
$default_value = '';

// set collapse true
$collapse = TRUE;

// assuming you're passing $form_state into your form definition, if not, do so
if ($form_state['storage']['add_rep_share_fieldset']['share_with_rep_region'] !== $default_value) {
    $collapse = FALSE;
}

$form['add_rep_share_fieldset'] = array(
    '#type' =&gt; 'fieldset',
    '#title' =&gt; t('Share with Rep'),
    '#prefix' =&gt; '&lt;div id="' . $cur_div_wrapper_name . '"&gt;',
    '#suffix' =&gt; '&lt;/div&gt;',
    '#collapsible' =&gt; TRUE,
    '#collapsed' =&gt; $collapse,
);


I hope this shows the basic idea behind what I'm trying to say: $collapse = true by default, IF the user has interacted with the form in any way, $collapse = false