• 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
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

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.
 
Marshal
Posts: 16591
277
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
Marshal
Posts: 16591
277
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.
 
Think of how dumb the average person is. Mathematically, half of them are EVEN DUMBER. Smart tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic