hi
I have a form, an exposed filters view, which returns a list or nodes refined by taxonomy terms [exposed filters].
I used hook_form_alter to change the drop down list into checkboxes and put the terms in a collapsible fieldset using [prefix] = 'filedsest'.
cool, but..
I really want the fieldset to be in the last state [ collapsed / expanded ] the user left in , when they return to the view / form.
I made a really bad work around by making a hidden field in my form , who's value is changed by javascript by hacking collapse.js;
document.forms[0].fieldset1_hiddenfiled.checked = false;
document.forms[0].fieldset1_hiddenfiled.checked = ture;
then in the hook_form_alter, the filter has a prefix which is determined either the hidden field's value, or its previous value.
this is very messy and only work for 1 fiedset.
can someone with knowledge of javascript tell me how i can get the value or legend or title of the fieldset that is triggering the collapse.js in the javascript code, then i can return a value to a hidden field of corresponding name.
i tried
this.parentNode.title
this.parentNode.legend
but these return, undefined.
i want the code to be something like below;
1] var filter_hf = this.parentNode.title; // which would ideally return the legend or name of filter
2] document.forms[0].filter_hf.checked = false; // where filter_hf is replaced by its string value from previous statements
then the rest is done in the hook_form_alter in php
so, what would the code be for getting the name of the fieldset? and how can i put that in the line 2] above ?
any help appreciated, especially a better way to achieve remembering collapsed fieldset states!