my dog learned polymorphism
The moose likes HTML, CSS and JavaScript and the fly likes Dynamic Select Lists 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 "Dynamic Select Lists" Watch "Dynamic Select Lists" New topic

Dynamic Select Lists

Anil Verghese
Ranch Hand

Joined: Oct 11, 2006
Posts: 155
Im doin a project in JSP.I have 2 drop downs , the second one should be populated using the value from the firsty . Both the drop downs are on the same page how do i get the value of the first drop down.

[BPSouther: Removed "Urgent from the subject line"]
[ November 01, 2006: Message edited by: Ben Souther ]
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Either you can submit the page once a selection is made in the frist dropdown (and then re-generate the page with the appropriate values), or use JavaScript to populate the second dropdown whenever a selection is made in the first. The "onChange" handler can be used for this.

By the way, in the future please use a descriptive subject line - "Need Help Urgent" does not convey anything about your problem, and most problems are urgent, so it's better to not mention that.
[ November 01, 2006: Message edited by: Ulf Dittmer ]
Anil Verghese
Ranch Hand

Joined: Oct 11, 2006
Posts: 155
Do you know how to do it using scripts ? Im not that good with scripting .Can you help me with it?
Ram kanana
Ranch Hand

Joined: Apr 13, 2006
Posts: 34
it is possible by using java script by writing innerHTML code
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

Moved to the HTML/Javascript forum.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Dynamic Select Lists
jQuery in Action, 3rd edition