Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 15th, 2005, 07:57 AM
Friend of Wrox
 
Join Date: May 2005
Posts: 149
Thanks: 0
Thanked 0 Times in 0 Posts
Default 2 dynamic dropdown

Hi,
Why does not this code work?
I get type mismatch error.


<%


Set rs = Server.CreateObject("ADODB.Recordset")
sQuery = "SELECT * From event_category order by Category"
rs.Open sQuery, conn, 2, 2
'on error resume next
%>
<html>
<head>
<title>Add Products</title>
<SCRIPT language="JavaScript">

function getListValue(list)
{
var listValue="";
if (list.selectedIndex != -1) {
listValue = list.options[list.selectedIndex].value;
}
return (listValue);
}
</script>
</head>
<body>

<div class="content">
<form name="formCategory" method="get" action="combo_test.asp" onSubmit="return formCheck(this);" >
<p title="This field is mandatory"><label for="qryCategory">Category</label>

<select name="qryCategory" onChange="this.form.action = '<%=Request.ServerVariables("Script_Name")%>'; this.form.submit();" <%=sErrorqryCategoryHighlight%>>

<option value="">Select A Category</option>
<%
Do While Not rs.EOF
%>
<option <%if Trim(rs("id"))=Trim(Request.querystring("qryCatego ry")) then Response.Write "selected" end if%> value=<%=rs("id")%>><%=rs("Category")%></option>
<%
rs.MoveNext
Loop
rs.Close
Set rs=Nothing
%>
</select>
<br/>
<%
If Request.querystring("qryCategory") = "" Then
%>
<p title="This field is mandatory"><label for="subcat">Sub Category</label>
<select name="subcat" cat_id="subcat">
<option value="">Select a Sub Category</option>
<%


Else

Dim strSQL
Set rs = SERVER.CreateObject("ADODB.Recordset")
strSQL = "SELECT * "
strSQL = strSQL & "FROM event_subcategory INNER JOIN event_category ON event_category.id=event_subcategory.Category "
strSQL = strSQL & "WHERE (((event_category.id) = '" & Request.querystring("qryCategory") & "'))"
rs.Open strSQL,conn, 3, 3



If rs.RecordCount = 0 Then
Response.Write("No records found for category " & Request.querystring("qryCategory"))
Else
%>
<p title="This field is mandatory"><label for="subcat">Sub Category</label>
<select name="subcat" id="subcat">
<%

If Not rs.EOF Then
Do While Not rs.EOF
%>
<option><%= rs("Subcategory") %></option>
<%
rs.MoveNext
Loop
%>
<%


Else
%>
<option value="">Error - no Sub Categories can be found</option>
<%
End If


rs.Close
Set rs= Nothing
%>

<%

end If

End if


%>

</select>

</p>

<p><input type="submit" name="mySubmit" value="Add Products" class="button" /><input type="reset" name="reset" value="Clear" class="button" /></p>

</form>
</div>
</body>
</html>







Similar Threads
Thread Thread Starter Forum Replies Last Post
Edit in Place with Dynamic Dropdown neojakey Ajax 1 September 28th, 2008 11:01 PM
Two Level Dynamic DropDown Question workib ASP.NET 3.5 Basics 6 May 14th, 2008 09:18 PM
Dynamic Dropdown bullsb Classic ASP Professional 4 March 9th, 2007 07:42 AM
Javascript Dynamic dropdown Menu itHighway Javascript How-To 0 July 24th, 2005 10:53 PM
dynamic dropdown boxes fmh002 Classic ASP Basics 1 June 26th, 2003 08:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.