Submit button to select all items in a SELECT menu

Discussion in 'Javascript' started by Gumtree, Nov 9, 2004.

  1. Gumtree

    Gumtree Guest

    Hi folks,

    The user interface I'm trying to impliment looks a bit like
    this:

    Not Chosen Chosen
    .------------. .------------.
    |Item 1 | -> |Item 3 |
    |Item 2 | <- |Item 4 |
    |Item 6 | >> |Item 5 |
    | | << |Item 7 |
    `------------' `------------'

    [Submit button]

    All works so far, however, items not selected in the right
    hand SELECT menu don't get passed as values when submitted.
    Is there a recommended way to automatically select all items
    in a SELECT menu on the click of the Submit button?

    Any bits of code or URL suggestions most appreciated. Thanks.
     
    Gumtree, Nov 9, 2004
    #1
    1. Advertising

  2. Gumtree

    Zifud Guest

    Gumtree wrote:
    > Hi folks,

    [...]
    > All works so far, however, items not selected in the right


    All what?

    >
    > Any bits of code or URL suggestions most appreciated. Thanks.
    >


    Perhaps if you post a concise example of what you have done you will
    get some help. I can think of at least 4 different ways of
    implementing what you describe, all of which may be totally different
    to how you have done it.

    Zif.
     
    Zifud, Nov 9, 2004
    #2
    1. Advertising

  3. Gumtree

    Gumtree Guest

    Zifud <> wrote:
    > Gumtree wrote:
    >> Hi folks,

    > [...]


    ] The user interface I'm trying to impliment looks a bit like
    ] this:
    ]
    ] Not Chosen Chosen
    ] .------------. .------------.
    ] |Item 1 | -> |Item 3 |
    ] |Item 2 | <- |Item 4 |
    ] |Item 6 | >> |Item 5 |
    ] | | << |Item 7 |
    ] `------------' `------------'
    ]
    ] [Submit button]

    >> All works so far, however, items not selected in the right

    >
    > All what?


    The interface: ie, the JS that covers moving items from List 1
    to List 2 and back -- individually and groups.

    >> Any bits of code or URL suggestions most appreciated. Thanks.

    >
    > Perhaps if you post a concise example of what you have done you will
    > get some help.


    There was hardly any point rabbitting on about the code that
    works, considering it was irrelevant to the problem. The
    question was:

    ] items not selected in the right hand SELECT menu don't get passed
    ] as values when submitted. Is there a recommended way to automatically
    ] select all items in a SELECT menu on the click of the Submit button?

    (God only knows why you snipped the question in your reply...)

    > I can think of at least 4 different ways of
    > implementing what you describe, all of which may be totally different
    > to how you have done it.


    Not to worry. I ended up redesigning the interface so as to not
    need Javascript.

    The Javascript would have been prettier UI, but, the replacement
    is functional. Quite a relief though not to have to worry about
    the idiocies of client browser incompatibilities, the effects of
    JS not being enabled on browsers, etc.

    All the best.
     
    Gumtree, Nov 10, 2004
    #3
  4. Gumtree

    Matt Kruse Guest

    Gumtree wrote:
    > The user interface I'm trying to impliment looks a bit like
    > this:
    > Not Chosen Chosen
    > .------------. .------------.
    > |Item 1 | -> |Item 3 |
    > |Item 2 | <- |Item 4 |
    > |Item 6 | >> |Item 5 |
    > | | << |Item 7 |
    > `------------' `------------'


    I have a lib which implements this exact functionality. It stores values in
    hidden fields to keep track of which items were added or removed from each
    list, plus all the contents of each list. I prefer this method to selecting
    all options in the target list before submitting.

    http://www.javascripttoolbox.com/optiontransfer/

    > Is there a recommended way to automatically select all items
    > in a SELECT menu on the click of the Submit button?


    If you did want to go this route, you could use selectAllOptions() in my
    functions at
    http://www.javascripttoolbox.com/selectbox/

    --
    Matt Kruse
    http://www.JavascriptToolbox.com
     
    Matt Kruse, Nov 10, 2004
    #4
    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. Bryan
    Replies:
    1
    Views:
    812
    Steven Cheng[MSFT]
    Mar 1, 2006
  2. Tina Li
    Replies:
    0
    Views:
    327
    Tina Li
    Sep 18, 2003
  3. Larry Bud
    Replies:
    13
    Views:
    7,819
    Larry Bud
    Jan 7, 2008
  4. Matt
    Replies:
    2
    Views:
    232
    Roland Hall
    Jan 11, 2004
  5. Bonge Boo!
    Replies:
    5
    Views:
    231
    Bonge Boo!
    Apr 25, 2005
Loading...

Share This Page