By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,836 Members | 1,703 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,836 IT Pros & Developers. It's quick & easy.

Back button and select lists in IE

P: n/a
In a form, I have two select lists. One holds the available options.
I have some buttons between them for moving items from one list to the
other. When the form first loads, all of the items are in the
available list and none are in the used list.

Available Used
--------------- ---------------
|item1 | |item3 |
|item2 | >> | |
|item4 | > | |
| | < | |
| | << | |
| | | |
--------------- ---------------

When you move an item, I either add it to or remove it from a
comma-delimited list in a hidden input box. When the form is
submitted, I do fun things with the contents of the hidden input box to
make pretty output.

When you click the back button in Mozilla Firefox, You get the form
just as it was when you submitted it, which is good. However, when you
click the back button in IE, the two select list boxes display like
they would after a fresh page load. At the same time, instead of
defaulting to blank, the hidden input box retains its contents that it
had at the time of the form submision. This means that you can have
multiple instances of the same item in the hidden input box, which
reaks havok on my action page.

Does anyone know how to fix this problem in IE?

Thanks,
Chris Lieb

Apr 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Chris Lieb said the following on 4/14/2006 10:32 AM:
In a form, I have two select lists. One holds the available options.
I have some buttons between them for moving items from one list to the
other. When the form first loads, all of the items are in the
available list and none are in the used list.

Available Used
--------------- ---------------
|item1 | |item3 |
|item2 | >> | |
|item4 | > | |
| | < | |
| | << | |
| | | |
--------------- ---------------

When you move an item, I either add it to or remove it from a
comma-delimited list in a hidden input box. When the form is
submitted, I do fun things with the contents of the hidden input box to
make pretty output.
That sounds like making it harder than it is. Simply submit the form and
let the server pick up the options of the second select list. onsubmit
you make them all selected and then the server will get the list.
When you click the back button in Mozilla Firefox, You get the form
just as it was when you submitted it, which is good.
Depends on how you look at it.
However, when you click the back button in IE, the two select list
boxes display like they would after a fresh page load.
That is, perhaps, the way it is supposed to work. You are in fact
reloading the page (sort of). You are just reloading it from the cache
instead of the server.
At the same time, instead of defaulting to blank, the hidden input box
retains its contents that it had at the time of the form submision.
Now that is bad. If IE is going to reset the selects then it should
reset the hidden inputs as well.
This means that you can have multiple instances of the same item in
the hidden input box, which reaks havok on my action page.


When anything is added to the hidden field, rather than add to it,
replace the hidden fields contents with the contents of the select list.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.