Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dependent ComboBoxes

Author  Topic 

computerforce
Starting Member

10 Posts

Posted - 2006-04-24 : 04:43:01
Any simple solution for:

Two level dependent ComboBoxes in Javascript for ASP (3.0), with SQL Server backend (ComboBoxes are to be populated from SQL Server database tables).

For Example:

tbl_countries
IDcountry
country

tbl_cities
IDcity
city
IDcountry

First combobox is to be made from tbl_countries, second from tbl_cities.

Any idea (Javascript - onchange event .... ) ?

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-04-24 : 05:01:54
On change even of Tbl_Countries fill tbl_cites ..

query will be somthing like this

Select City From Tbl_Cities Where IDCountry = <Country selected in the drop down>

If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

computerforce
Starting Member

10 Posts

Posted - 2006-04-24 : 10:04:23
Thanks for the response.

SQL Query is the easy part.

How to refresh the second combo when first combo is changed? Onchange is okay, but how to implement it completely?

How to make the second combo be populated (from SQL Server) properly, when something is being chosen from the first combo, in a practical example? Is there a simple solution for this, including DHTML / Javascript for ASP?
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2006-04-24 : 10:11:10
onchange?...would that not kick in too often...especially when you are loading the combobox for the 1st time? is there not a onclick/ondoubleclick event?
Go to Top of Page

computerforce
Starting Member

10 Posts

Posted - 2006-04-25 : 09:44:05
Thanks for the response....

Second Combo would be empty, or "SELECT...." would be SELECTED, when the form is loading for the first time. Similar to the first Combo.

When anything would be choosen from the second combo - it would trigger the second combo, by onchange event in first combo.
Go to Top of Page
   

- Advertisement -