Back button and select lists in IE

Discussion in 'Javascript' started by Chris Lieb, Apr 14, 2006.

  1. Chris Lieb

    Chris Lieb Guest

    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?

    Chris Lieb
    Chris Lieb, Apr 14, 2006
    1. Advertisements

  2. Chris Lieb

    Randy Webb Guest

    Chris Lieb said the following on 4/14/2006 10:32 AM:
    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.
    Depends on how you look at it.
    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.
    Now that is bad. If IE is going to reset the selects then it should
    reset the hidden inputs as well.
    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 Webb, Apr 14, 2006
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.