• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

drop down box using struts

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two dropdown box when a user select the first dropdown box.
the second dropdown box will be populated with data without affecting other controls in the form.

Example the first dropdown box is populated a list of department, so when theuser selects a department the second combo box will be populated the list of employees belonging to that department that was selected by the user on the first dropdown box without affecting other controls in the form?
Both dropdown box get the data from the database.

Can some one show me how to do this?

Thanks very much.
 
Sheriff
Posts: 17665
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"pfcbuilder pfcbuilder"

Please edit your profile so that your publicly displayed name complies with the JavaRanch Naming Policy. Thank you for your cooperation.
 
Junilu Lacar
Sheriff
Posts: 17665
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are at least two ways to do this:

1. Call a JavaScript function in the onchange event of the first dropdown. This means that you will have to create JavaScript arrays that will hold all the possible combinations.

2. Submit the form via a JavaScript function call in the onchange event. In the backend, detect what the selected item was in the first drop down and then re-populate the options collection for the second drop down accordingly.
 
Today you are you, that is turer than true. There is no one alive who is youer than you! - Seuss. Tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic