I have two dropdown boxes. I want to filter one drop down box depending on what is selected by the other. So a user comes in and selects a value in the divison ("ddlDiv") list. Based on what this value is it then it goes to the Access database and filters on this value and populates the markets list ("ddlMarket").
Currently I would populate the ddlMarket like this where MSO is the divisiion and filterMarket is the function on the onchange event on ddlDiv <select id="ddlDiv" style="width: 170px; background-color: yellow;" name="division" onchange="filterMarket()" language="javascript">:
function filterMarket() {
if(document.CE_EntryInfo.d
dlDiv.valu
e==0)
{
alert( 'Division value S/B=0 : ' + document.CE_EntryInfo.ddlD
iv.value);
}
else
{
alert( 'Division value S/B<>0 : ' + document.CE_EntryInfo.ddlD
iv.value);
}
}
<select id="ddlMarket" style="width: 170px; background-color: yellow;" name="dma">
<option value="0">-- Select Market --</option>
<%
'Dim objConnection, objRS
'Create the recordset object
Set objRS = Server.CreateObject("ADODB
.Recordset
")
objRS.Open "SELECT Dmas.Division, Dmas.DMAID, Dmas.DMANAME FROM Dmas GROUP BY Dmas.Division, Dmas.DMAID, Dmas.DMANAME HAVING (((Dmas.Division)='MSO')) ORDER BY Dmas.DMANAME;", "dsn=CompEvents"
'SELECT [Timing].[Season] FROM Timing GROUP BY [Timing].[Season] UNION select '-- Select a Season --' as Season FROM Timing ORDER BY [Timing].[Season]; 'Loop through the recordset adding each Division to the combo box
Do While Not objRS.EOF
%>
<option value="<%=objRS("DMAID")%>
"> <%=objRS("DMANAME")%></opt
ion>
<%
objRS.MoveNext
Loop
'Close and dereference database objects
objRS.Close
Set objRS = Nothing
Set objConnection = Nothing
%>
</select>
Start Free Trial