Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic drop down boxes

Status
Not open for further replies.

riches85

Programmer
Nov 13, 2002
59
US
I am creating a statistical database and I had a quick question. I have a page that allows you to select a game and select a player to see that players stats for that game. As of now I have each drop down show the players and games for a given season (year). I would like to take this further by somehow making it so that when selecting the game, the second drop down box would then perform a query and pull the names of teh players for that game. I want to know if this is possible without hitting the submit button. Any help would be greatly appreciated. Thanks
 
We do a similar thing here. We use javascript in the jsp to reload the page - put the OnChange= parameter on the first drop-down list and create a javascript function to reload the same page again:

function OnDDLChange()
{
document.formA.action="myjsp.jsp";
document.formA.submit();
}


On the reloaded page you can then populate the second drop-down box.
 
I have done this for Internet explorer
Basically you need to create two arrays in JSP.
The first may have game name ,game code and player name. Here game code is a primary key.
The second will have player name and and game code. I am assuming that you are actually passing the game code when you select a game name.

Then you need to populate two javascript arrays with exactly the same values as the java arrays.

when the first listbox is changed, the game code is checked and the corresponding player names with the same game code in the second array populates the second listbox

I will give you the code for my program
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top