Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

creating dynamic dropdowns  RSS feed

 
Bob Backlund
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Hoping you can help...

I have an admin enter page which has 2 dropdown boxes, one with all the staff available and one with all the different jobs they can do. At the moment the two dropdowns are very long (one has 188 users, the other 200+ jobs), but on average a user can perform only around 6 of those jobs each.

What I would like it to do is somehow change it so that when you select a user the second dropdown only shows jobs that user can do.

I have the users and jobs in a SQL DB and a matrix table linking users to jobs. So I need some sort of Javascript function which will dynamically create a SQL query to search for all jobs under thet user's ID.

I'm presuming the onChange() function will come into effect here...

Cheers
[ March 28, 2006: Message edited by: Bear Bibeault ]
 
Ajith George
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way to this is. Upon on change of first drop down submit the page with arguments containing id of selected user. Try submitting to the same page itself. Upon loading the page second time call the corresponding method which you should be written to get the jobs selected for the selected user. Then load it on the drop down.

Please provide proper validation while the page is loading for the first time ie when no person is seleced.
OK.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has been discussed many many times. Please search this and the HTML forum for previous topics. The most common method being used at this point for this is to submit an Ajax request to fetch the secondary drop-down's values.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!