Forums
This topic is locked
dependent drop down menu assistance required
Posted 03 Oct 2007 13:24:08
1
has voted
03 Oct 2007 13:24:08 Russell Isaac posted:
can anyone point me in right direction...? have used MX Kollection to produce dependent drop-down menu - it works fine with two form elements but i need three - i.e. i need them to select from "commercial" or domestic", which needs to populate a second menu listing relevant brands, then click on brand to get list of models in third box.i can get it any two menus to do A to B or B to C but if i try doing all three, only A to B or B to C works - code follows- anyone got any pointers - much appreciated. thanks
<%@LANGUAGE="VBSCRIPT"%>
<!-- #include file="includes/wdg/WDG.asp" -->
<!--#include file="Connections/parts_price.asp" -->
<%
Dim rs_commdom
Dim rs_commdom_numRows
Set rs_commdom = Server.CreateObject("ADODB.Recordset"
rs_commdom.ActiveConnection = MM_parts_price_STRING
rs_commdom.Source = "SELECT * FROM commDom"
rs_commdom.CursorType = 0
rs_commdom.CursorLocation = 2
rs_commdom.LockType = 1
rs_commdom.Open()
rs_commdom_numRows = 0
%>
<%
Dim rs_mfr
Dim rs_mfr_numRows
Set rs_mfr = Server.CreateObject("ADODB.Recordset"
rs_mfr.ActiveConnection = MM_parts_price_STRING
rs_mfr.Source = "SELECT * FROM img_mfr"
rs_mfr.CursorType = 0
rs_mfr.CursorLocation = 2
rs_mfr.LockType = 1
rs_mfr.Open()
rs_mfr_numRows = 0
%>
<%
Dim rs_image
Dim rs_image_numRows
Set rs_image = Server.CreateObject("ADODB.Recordset"
rs_image.ActiveConnection = MM_parts_price_STRING
rs_image.Source = "SELECT * FROM images"
rs_image.CursorType = 0
rs_image.CursorLocation = 2
rs_image.LockType = 1
rs_image.Open()
rs_image_numRows = 0
%>
<%
Dim MM_paramName
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "" Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
End If
Next
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
End If
Next
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "" Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "" Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "" Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "" Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" src="includes/common/js/sigslot_core.js"></script>
<script src="includes/common/js/base.js" type="text/javascript"></script>
<script src="includes/common/js/utility.js" type="text/javascript"></script>
<script type="text/javascript" src="includes/wdg/classes/MXWidgets.js"></script>
<script type="text/javascript" src="includes/wdg/classes/MXWidgets.js.asp"></script>
<script type="text/javascript" src="includes/wdg/classes/JSRecordset.js"></script>
<script type="text/javascript" src="includes/wdg/classes/DependentDropdown.js"></script>
<%
'begin JSRecordset
Dim jsObject_rs_mfr: Set jsObject_rs_mfr = new WDG_JsRecordset
jsObject_rs_mfr.Init "rs_mfr"
Response.write jsObject_rs_mfr.getOutput()
'end JSRecordset
%>
<link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<%
'begin JSRecordset
Dim jsObject_rs_image: Set jsObject_rs_image = new WDG_JsRecordset
jsObject_rs_image.Init "rs_image"
Response.write jsObject_rs_image.getOutput()
'end JSRecordset
%>
</head>
<body>
<p>
<select name="select_commdom" id="select_commdom">
<%
While (NOT rs_commdom.EOF)
%>
<option value="<%=(rs_commdom.Fields.Item("type".Value)%>"><%=(rs_commdom.Fields.Item("type".Value)%></option>
<%
rs_commdom.MoveNext()
Wend
If (rs_commdom.CursorType > 0) Then
rs_commdom.MoveFirst
Else
rs_commdom.Requery
End If
%>
</select>
</p>
<p>
<select name="select_mfr" id="select_mfr">
</select>
</p>
<p>
<select name="select_model" size="12" id="select_model" wdg:subtype="DependentDropdown" wdg:type="widget" wdg:recordset="rs_image" wdg:displayfield="model" wdg:valuefield="ID" wdg:fkey="brand" wdg:triggerobject="select_mfr">
</select>
</p>
</body>
</html>
<%
rs_commdom.Close()
Set rs_commdom = Nothing
%>
<%
rs_mfr.Close()
Set rs_mfr = Nothing
%>
<%
rs_image.Close()
Set rs_image = Nothing
%>
Replies
Replied 05 Oct 2007 19:01:29
05 Oct 2007 19:01:29 Lee Diggins replied:
Hi Russell
Have you got the menu B set as the master for the menu C? I've built multi dependent dropdowns a long time ago with MXKollection and never had an issue and unfortunatley this is from memory.
Menu A id must be in the rs for menu B, menu A must be the master for menu B.
Menu B id must be in the rs for menu C, menu B must be the master for menu C.
That's all I can think of for now. I'll see what else I can dig up.
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Have you got the menu B set as the master for the menu C? I've built multi dependent dropdowns a long time ago with MXKollection and never had an issue and unfortunatley this is from memory.
Menu A id must be in the rs for menu B, menu A must be the master for menu B.
Menu B id must be in the rs for menu C, menu B must be the master for menu C.
That's all I can think of for now. I'll see what else I can dig up.
Sharing Knowledge Saves Valuable Time!!!
~ ~ ~ ~ ~ ~
<b>Lee Diggins</b> - <i>DMXzone Manager</i>
<font size="1">[ Studio MX/MX2004 | ASP -> VBScript/PerlScript/JavaScript | SQL | CSS ]</font>
Replied 05 Oct 2007 19:58:47
05 Oct 2007 19:58:47 Russell Isaac replied:
thanks for the starting point - i thought it was corerctly coded but i'll take another look. if you do dig amything else up i'd be grateful. thanks again