View Full Version : 3 layers dropdown list using ASP + SQL Server.

07-30-2002, 03:41 AM

i'm using ASP try to generate a member registration form, let user enter their name, sex, address, country , state... all the record are from Database.

what problem that i faced is, i want the "State" drop down list changed when user choose different "Country", and when "Postal Code" will Changed when user choose different "State". Can do it without refresh the page? and there are so many countries in the world, if i retrieve all the record of state that belongs to the country it it will be long downloading time??? how to solve them... like hotmail they will refresh the page... but i hope i can do is without refresh the page and not too slow 4 the loading time...

here is the HTML Code:
<select name="select" size="1">
<option selected>Choose Country</option>
<select name="select2">
<option selected>Choose State based on your selected Country</option>
<select name="select3">
<option selected>Choose Post Code based on your selected State</option>

07-30-2002, 05:11 AM
if you want to do it without refreshing the page, you need javascript to do it. but you have to load all the states and postal codes of each country in hidden fields. there are lots of triple combo scripts out there, try to look for them

07-31-2002, 01:02 AM
Glenn is 100% correct... with *any* server-side language (not just ASP), a request must be made to the server in order to update the page, which can't be done without refreshing the page (or a hidden frame, in which case you'd still have to use javascript on the client-side).

That's why in order to accomplish this without refreshing, you need a client-side solution (javascript).

I'll move this post to the javascript programming forum, so you can get more help with dropdown combos.

P.S. You might want to look at the scripts available for this kind of thing already on http://www.javascriptkit.com !

08-28-2002, 07:34 PM
I have been working on a problem just like the one you are talking about, and I have been able to do exactly what you're talking about.

However, I have found that when dealing with large recordsets, the triple combo approach doesn't work very well (I am, and it sounds like you might be). The code generated by the javascript is 28,490 lines long! It takes about 5 minutes to load every time the page is accessed. Granted, I am working with VERY large recordsets, and right now, I am using three ODBC connections. I have a feeling that with just one, I could cut down the load time substantially.

Anyway, if you'd still like the code, please let me know :)