Hi,
I created a page the has drop menus based on database recordsets that filter each other . The only problem i run into is keeping the only problem i'm having is holding the view state of the first dropmenu after it reloads. I've tried cookies, session states...am i doing something wrong?? this is my code for the cookies and the form:

<% select=request.cookies("select")
if select="false"
then end if
%>
<form name="form1" method="post" action="" >
<p> Make
<select name="select" id="select" value="select">
<%
While (NOT Recordset1.EOF)
%>
<option value="<%=(Recordset1.Fields.Item("VechicleMakeID").Value)%>"><%=(Recordset1.Fields.Item("VechicleMake").Value)%></option>
<%
Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</p>
<p>Model
<select name="select2" id="select2">
<%
While (NOT Recordset2.EOF)
%>
<option value="<%=(Recordset2.Fields.Item("ModelID").Value)%>"><%=(Recordset2.Fields.Item("Model").Value)%></option>
<%
Recordset2.MoveNext()
Wend
If (Recordset2.CursorType > 0) Then
Recordset2.MoveFirst
Else
Recordset2.Requery
End If
%>
</select>
</p>
<p>parts
<select name="select3">
</select>
</p>
<p>
<input type="submit" name="Submit" value="Continue" >
</p>
</form>
<%
Response.cookies("select")=select
%>


Any Ideas??

You need to capture the value of the first select, then test that for each value through the loop when generating the select options. If the value match then set the option selected attibute to selected. Example:

select1 = request.form("select")
While (NOT Recordset1.EOF)
	response.write "<option value=""" & Recordset1("VechicleMakeID")
	if select1 = Recordset1("VechicleMakeID") then
		response.write "selected = """selected""" 
	end if
	response.write """>" & Recordset1("VechicleMake") & "</option>"
Recordset1.MoveNext()
Wend

set the select box to submit the form. then have the next select box request.form("firstselectvalue") it. that way you can set up a if select1 hasnt been submited the disable select 2 etc

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.