Submit button to select all items in a SELECT menu

G

Gumtree

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.
 
Z

Zifud

Gumtree said:
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.
 
G

Gumtree

Zifud said:
Gumtree said:
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 what?

The interface: ie, the JS that covers moving items from List 1
to List 2 and back -- individually and groups.
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.
 
M

Matt Kruse

Gumtree said:
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/
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top