...

View Full Version : drop down help



loco joe
08-23-2004, 05:39 PM
hey all, I need help with this, I am accessing a data base to fill in a drop down menu. I have managed to get my first drop down menu to do this, but now for the second box I need it to sellect another table from the data base.depending on the first choice. I have converted the record sets in to arrays but now i need the second menu to update it self before hitting the submit button. here is my code.


----------------------
<% @ Language = VBScript %>
<%Option Explicit%>
<!--#include file="connection.asp"-->
<!--#include virtual="adovbs.inc"-->
<%
Dim objRS
Dim arr
dim quad
dim yard
dim i
Set objRS = Server.CreateObject ("ADODB.Recordset")
objRS.open "LabLoc", dcnDB, , ,adCmdTable
arr = objRS.getrows()
objRS.Close
objRS.open "Quad", dcnDB, , ,adCmdTable
quad = objrs.getrows()
objRS.Close
objRS.open "Yard", dcnDB, , ,adCmdTable
yard = objrs.getrows()
objRS.Close
set objRS = nothing
dcnDB.Close
set dcnDB = nothing
%>

<HTML>
<BODY>

Multiple field search

<form method =post action="mfsearch.asp">
<!--search for computer location client side -->
Computer Location:

<select name="Location" size ="1" onChange="redirect(this.options.selectedIndex)">
Response.Write "<option selected=""selected"" value="""">Choose....</option>"

<%for i = 0 to ubound(arr,2)
Response.Write "<option value="""">" &(arr(0,i))
next
Response.Write "</option>"
%>
</select>

<select name="houseloc" size="1">
response.write "<option selected=""selected"" value="""">choose from campus location first </option>"
</select>

A1ien51
08-23-2004, 06:32 PM
You need to post back the information to the server when the first element is changed. You either have to submit a form or add information to the query string. It is a lot easier with .NET

Eric

miranda
08-24-2004, 12:50 AM
As A1ein51 said, you can change the onChange event in the first dropdown to handle a postback event and then using the info from the 1st selection to fill the 2nd dropdown

Or

You can use the information in these arrays to fill clientside javascript arrays. That way when the user selects one item the javascript automatically selects the proper array.

glenngv
08-24-2004, 06:53 AM
You can use the information in these arrays to fill clientside javascript arrays. That way when the user selects one item the javascript automatically selects the proper array.
Use this Double combo javascript (http://wsabstract.com/script/cut183.shtml). Generate javascript arrays in the server-side.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum