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?

    Thanks,
    Chris Lieb
    Chris Lieb, Apr 14, 2006
    #1
    1. Advertising

  2. Chris Lieb

    Randy Webb Guest

    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/
    Randy Webb, Apr 14, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henke
    Replies:
    0
    Views:
    376
    Henke
    Jul 1, 2003
  2. sylvia sil
    Replies:
    1
    Views:
    614
    Curt_C [MVP]
    Dec 29, 2004
  3. =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==

    List of lists of lists of lists...

    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==, May 8, 2006, in forum: Python
    Replies:
    5
    Views:
    399
    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==
    May 15, 2006
  4. Larry Bud

    Select Box, Back Button, and No Cache

    Larry Bud, Jan 17, 2006, in forum: ASP General
    Replies:
    0
    Views:
    143
    Larry Bud
    Jan 17, 2006
  5. Dan Thomas
    Replies:
    0
    Views:
    273
    Dan Thomas
    Feb 2, 2011
Loading...

Share This Page