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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update Second Combo Box Based on First Combo Box Choice

Status
Not open for further replies.

jayplus707

Programmer
Jul 29, 2002
17
0
0
US
Please help me....

I basically want to update the options available in my second combo box based on what the user chose from my first combo box. I saw a couple of examples already, but each of them refreshed the page and I'm sure there must be a way to do this without reloading the whole page.

Also, I saw another example with the values already preloaded in arrays and I'm wondering if you could help me do this with values I query from a SQL Server database.

I think a really good example of this is
Thank you so much.
 
For most of your javascript select box population questions, look at the code examples in FAQ under section 6b. That will show you how to add and remove items on the fly. To load up the array, simply do a Select from your database to get the fields you want from the table containing them. Then create an array that is two-dimensional (like arrayname[x,y]) and store the Name of each list item in the x portion of the array and the actual ID field for that item in the Y portion of the array. Loop through the recordset from your Select and increase the values of your array as you go through the loop. Then use the array for your select boxes. There are examples of this all over this messageboard, and a perfect EXACT example can be found in McGraw Hill's Complete Javascript Reference (great book).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top