File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes Problem in Multiple Select of drop down Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Problem in Multiple Select of drop down" Watch "Problem in Multiple Select of drop down" New topic

Problem in Multiple Select of drop down

mahadevan raja
Ranch Hand

Joined: Apr 11, 2001
Posts: 96
hi all,
i have a multiple select drop down
which has the following values
1.All (Users)
now what i want to do is when i select "All" then the other values i.e
a.User1,User2,User3,should automatically get selected.
b.If i select All and then any other User then i should show the user that u have selected All already,so cant select other users
Plz reply soon,me in trouble.
Thanx in Advance.

SPECIALIST-WCSV5.1 Implementation.<br />SYSTEMS EXPERT-WAS4.0 Administration
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
For the record, there is no HTML multi-select drop-down. There is only the multi-select list box. If you are getting the "drop-down" functionality in a select, then it isn't multi-select.
As for the "All" option, you will have to put an onChange() event handler in your <SELECT> tag. This event will be fired when the user selects/deselects an option in your list box. From there you will have to write some logic to determine if "All" has been selected or if it was already selected. If it was chosen then you can force the selection of all the available options. If it was already selected and the user chooses something else, you can then return false from your function, cancelling the change event.
Vijay S. Rathore
Ranch Hand

Joined: Oct 29, 2001
Posts: 449
Check and customize this as per your needs

SCJP, SCJD, SCWCD1.4, IBM486, IBM484, IBM 483, IBM 287, IBM141, IBM Certified Enterprise Developer - WebSphere Studio, V5.0
Author of IBM 287 Simulator Exam
mahadevan raja
Ranch Hand

Joined: Apr 11, 2001
Posts: 96
thanx vijay rathore,
the link u gave me was very useful,thanx a lot again,u solved my problem.
I agree. Here's the link:
subject: Problem in Multiple Select of drop down
jQuery in Action, 3rd edition