Hi,
I had back-ported the collapsible fieldsets to 4.6, and haven't managed to test the final implementation in 4.7 yet, so maybe this issue has already been fixed in 4.7:

it annoyed me that the fieldsets were always closed after a page reload, so I made a few changes to collapse.js, so that now fieldsets that you open, will remain open when you return to that page.
The open fieldests are remembered in a cookie that is cleared when the browser is closed, and no changes are needed to anything besides collapse.js.

I attached the changed collapse.js in case it helps (needs proper testing though), or has this issue been handled already?

CommentFileSizeAuthor
collapse.js.txt2.11 KBrichardb

Comments

nedjo’s picture

Good idea. This isn't directly related to jstools since collapse.js is part of Drupal core. Do y ou want to move the issue to the Drupal project?

In jstools we are doing something similar with collapsiblocks.

Tobias Maier’s picture

Project: Javascript Tools » Drupal core
Version: 4.7.x-1.x-dev » x.y.z
Component: Collapsiblock » forms system
Status: Active » Needs review

moving...
and a untested 1+ from my side...

moshe weitzman’s picture

could we get a real patch? see http://drupal.org/diffandpatch

nedjo’s picture

Good idea. We should however add cookie support in a general, reusable way. We could use the cookie setting and getting methods in jstools.js, see the Javascript Tools module. These methods are used to maintain collapse states over sessions in the collapsiblock module in Javascript Tools.

recidive’s picture

It would be nice to have a common persistency mechanism that stores states in database instead of cookies. So all javascript widgets, core or not, will be able to use this for storing its states through AJAX calls. I saw a similar approach in Ruby on Rails, that uses the Scriptaculous library. All widgets/components in Scriptaculous have a serialize() method that implodes their state in a query string ready to be used to call an AJAX handler that store the state. Like position (x,y) for Draggables.

monkeybeach’s picture

Just tried the code above on 4.7 and it doesn't seem to work. Doesn't produce any warnings or errors in javascript console and I have cookies allowed.

Is it safe to assume the code is 4.6 only?

recidive’s picture

Is it safe to assume the code is 4.6 only?

This doesn't make sense because Drupal 4.6 doesn't have collapsible fieldsets.

monkeybeach’s picture

I had back-ported the collapsible fieldsets to 4.6

It does in that context :)

However the code now works. I flushed the cookies and it worked fine. Stupid oversight of my own making ;-)

dmitrig01’s picture

Version: x.y.z » 4.6.6
Status: Needs review » Closed (fixed)

4.6 no longer supported