Back button and select lists in IE

C

Chris Lieb

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
 
R

Randy Webb

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top