views:

91

answers:

1

I'm pretty sure I can't do what I'm actually asking, but am wondering if there is some sort of workaround for the issue.

I have a page that has a drop down SELECT form element with several options. If one particular option (in this case, the first item) is selected, we show additional content (via jQuery). This works fine.

What happens, though, is that if I select item 2, the additional content disappears, as it should. I then go to a different page and then hit BACK. A that point, the page properly has kept that additional content hidden (as it was the last state) but the SELECT menu has been reset to the first item. I then have to click the SELECT, pick a different option, then select it again picking the first option, which finally brings the additional content back.

I can't trigger Javascript from what I can tell on a cached page (or is there a way?) Any other clever options?

One option I've come up with is to apply some sort of mouseover action to the area that houses the SELECT menu that does a quick 'reset elements' check. This seems a bit hacky and, of course, will produce an odd screen redraw unexpectedly for people.

A: 

You can record that the user action has taken place and re-execute it using JavaScript. You can store it in a cookie, then check for it on page load and reset the elements you want.

Diodeus
The issue is it appears one can't trigger load events on a cached page.
DA
Don't put the initialization in the load, put it inline at the bottom of the page.
Diodeus
Same issue. The page is cached in the browser, so it doesn't actually re-render the page and, therefore, does not execute any inline scripts either. The issue really seems to be Firefox not caching the selected item in the SELECT input.
DA