wood burning stoves 2.0*
The moose likes JSP and the fly likes Dynamic Drop down based on another value in the same form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Dynamic Drop down based on another value in the same form" Watch "Dynamic Drop down based on another value in the same form" New topic
Author

Dynamic Drop down based on another value in the same form

Serena Zhou
Ranch Hand

Joined: Dec 13, 2003
Posts: 31
In a JSP form, I want to give one of the drop down box's select value from DB based on the value that user has chosen from another drop down box, So that If I have chosen Unit A from Unit drop down box, the Employee drop down box will only show the employees from Unit A instead of all the employees from whole organization(Say in DB, they are tables with foreign key referring to each other )

Is there any way to do it?

Thanks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61645
    
  67

Search through this and the HTML forum as this topic has been discussed on numerous occasions. You are bound to find info that is useful for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Quick hint: The simplest way would be to submit the form when the user selects a value in the first dropdown, and populate the second dropdown based on user selection when showing the from again.

Otherwise, you can use Javascript, iframes etc..to dynamically update the second dropdown. As Bear said, you will find info on that if you search through the HTML forum.

Cheers.


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic Drop down based on another value in the same form