Hi,
I'm super new to ASP so pardon my stoopidness.. anyway i've had a read thru the faqs on dynamic dropdowns and they mostly relate to filling second dynamic dropdowns.
What i want to do is build a page that takes a creates a dynamic dropdown that when a user selects an option it generates a stocklist based on the 'type'. I have been going round in circles with is one and not sure where to go now...
my code that works for the dropdown is this:
i thought that maybe something on the onChange event would work, but i guess javascript cant call/pass this to my vbscript..
:S stuck
____________________________________
Eat , Sleep , Live
I'm super new to ASP so pardon my stoopidness.. anyway i've had a read thru the faqs on dynamic dropdowns and they mostly relate to filling second dynamic dropdowns.
What i want to do is build a page that takes a creates a dynamic dropdown that when a user selects an option it generates a stocklist based on the 'type'. I have been going round in circles with is one and not sure where to go now...
my code that works for the dropdown is this:
Code:
<!-- #include file = "Datastore.asp" -->
<%
sub buildDropDown()
Dim strConnect, objRS
Set objRS = Server.CreateObject ("ADODB.Recordset")
objRS.Open "qryDropDown", conn
Response.Write "<form name='typeSelect'>"
Response.Write "<select name='dropdownlist'>" & vbCrLf
Response.Write "<option selected='selected' value=''>Choose....</option>"
While objRS.EOF = false
Response.Write "<option value=" & objRS.fields("Type").value & ">" & objRS.Fields("Type").Value & "</option>" & vbCrLf
objRS.movenext
Wend
Response.Write "</select></form>" & vbCrLf
end sub
%>
<html>
<head>
<title>Database List</title>
</head>
<body>
<%
call buildDropDown()
%>
</body>
</html>
i thought that maybe something on the onChange event would work, but i guess javascript cant call/pass this to my vbscript..
Code:
<%
sub selectMe(strIn)
Dim strCriteria, objRS
strCriteria = "Type = '" & strIn & "'"
Set objRS = Server.CreateObject ("ADODB.Recordset")
objRS.Open "qryStock", conn
objRS.Filter = strCriteria
Response.Write "<TABLE width='50%' border='0'><TR>"
While NOT objRS.EOF
Response.Write "<TD>" & objRS("SubType") & "</TD>" & "<TD>" & objRS("Desc") & "</TD> </TR>"
objRS.MoveNext
Wend
Response.Write "</TABLE></table>"
objRS.Close
Set objRS = Nothing
end sub
%>
<%
sub buildDropDown()
Dim strConnect, objRS
Set objRS = Server.CreateObject ("ADODB.Recordset")
objRS.Open "qryDropDown", conn
Response.Write "<form name='typeSelect'>"
Response.Write "<select name='dropdownlist' onchange='selectMe(this)'>" & vbCrLf
Response.Write "<option selected='selected' value=''>Choose....</option>"
While objRS.EOF = false
Response.Write "<option value=" & objRS.fields("Type").value & ">" & objRS.Fields("Type").Value & "</option>" & vbCrLf
objRS.movenext
Wend
Response.Write "</select></form>" & vbCrLf
end sub
%>
:S stuck
____________________________________
Eat , Sleep , Live