jQuery in Action, 3rd edition
The moose likes HTML, CSS and JavaScript and the fly likes how to make multiple combo boxes with same data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "how to make multiple combo boxes with same data" Watch "how to make multiple combo boxes with same data" New topic

how to make multiple combo boxes with same data

Sachin Negi

Joined: Feb 02, 2012
Posts: 23
i have a scenario in JSP where i have to make a combo with a list containing 10 items say 1,2,3.... 10. now i select a combo. I also need to provide an add button that will add another combo with same elements except the one being selected in previous combo.

eg- if 1st combo selected value is 1 then in the next combo i'll have the list as 2,3,4.....10 i.e, having 9 elements and so on. the user can add 10 combos like this, each combo having the items that haven't been previously selected.

can anyone help me with this???
thanks in advance !!!
Ackshat Sharma

Joined: Sep 03, 2011
Posts: 22
you can use a simple javascript code on any event you like to have(e.g click focus or blur etc) , the logic may vary as per your need. i would not prefer to do it with a java code in jsp since on browser i need a dynamic response without playing with request and response.

for information regarding javascript refer javascript examples
Keith Wood
Ranch Hand

Joined: Aug 28, 2012
Posts: 38

Using jQuery you would do something like this:

However, you'll need to think about what happens when the user goes back to one of the earlier select boxes and changes the value.

Author of the upcoming "Extending jQuery" book from Manning.
I agree. Here's the link: http://aspose.com/file-tools
subject: how to make multiple combo boxes with same data
It's not a secret anymore!