Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ASP AND SELECT BOXES
Message
 
To
06/09/2000 16:55:06
Todd Wolfe
Certified Marketing Services
Kinderhook, New York, United States
General information
Forum:
Internet
Category:
Active Server Page
Miscellaneous
Thread ID:
00413202
Message ID:
00413257
Views:
19
>I have a form with two select boxes that are populated using ASP. I would like to have the second one populate based on what is chosen in the first.
>
>For Example I have a select box of 50 states ,
>when the user selects a state I would like the select box of cities to populate. I have a recordset of the cities once the page is loaded.
>
>Any Ideas?
Todd;

You need to do this with client side JavaScript. You need to add an onchange hander to the select box and have it call some JavaScript to do what you want. If your list of cites is large, then you probably want to do a round trip to the server. If not, you can populate the second combobox in JavaScript code on the client. Below is a simple example of moving to different pages from a combobox. In your case you would probably go to the same page but have a different query string.

<HTML>

<script>
function goSomewhere(oControl){
if (oControl.value == "HOME")
location.href = "http://www.v-d-s.com"

if (oControl.value == "CONTACT US")
location.href = "http://www.v-d-s.com/contactus.asp"

if (oControl.value == "SERVICES")
location.href = "http://www.v-d-s.com/services.asp"
}
</script>

<BODY>

<SELECT onchange = "goSomewhere(this);" name="selWhere">
<OPTION value="HOME">Home</OPTION>
<OPTION value="CONTACT US">Contact Us</OPTION>
<OPTION value="SERVICES">Services</OPTION>
</SELECT>

</BODY>

</HTML>

If you want to see a good example of this type of interface, go to www.carpoint.com.
Jim Munn, MCSD
Visual Data Solutions
Previous
Reply
Map
View

Click here to load this message in the networking platform