-
Hi,
I have been searching through msdn and unfortunately found that the on_click event doesn't apply to drop down lists, so I was wondering if someone had an alternative for my problem.
Basically, I populate a list box by returning a recordset from a DB, and building a string of </option .. values as
while not oRs_TypeOFBusiness.EOF
Combo_tob = Combo_tob & "<option selected value=" & oRs_TypeOfBusiness("TypeOfBusiness") & ">" & oRs_TypeofBusiness("TypeOfBusiness") & "</option>"
ors_Typeofbusiness.MoveNext
wend
However, what I require is that when a customer clicks on an option in the list box, I want to fire an event that will cause a further selection based on the user selection, and populate another list box as a result.
For example if they clicked dogs from the list
dogs
cats
mice
I want to select a recordset from a database based on the word "dog" as a criteria of the search.
Any help appreciated.
Lenin
-
I think you want the onchange="" event of the SELECT control
Here's an extract from one of my own scripts that does the same thing.
Code:
<SELECT NAME="cboSupCode" onchange="ShowDetails(cboSupCode.selectedIndex)">
<%
'fill the suplier code combo box from the database
Set cmdTemp = Server.CreateObject("ADODB.Command")
Set T_Docs = Server.CreateObject("ADODB.Recordset")
'cmdTemp.CommandText = "SELECT SupplierCode from tblSupplier order by SupplierCode;"
cmdTemp.CommandText ="SELECT tblSupplier.CompanyName, tblSupplier.SupplierCode, tblSupplierTP.ContactName, tblSupplierTP.FaxNo " & _
"FROM tblSupplier INNER JOIN tblSupplierTP ON tblSupplier.SupplierCode = tblSupplierTP.SupplierCode " & _
"WHERE tblSupplierTP.TPCode =" & quote & tpcode & quote & " AND tblSupplierTP.inuse = true order by tblSupplier.SupplierCode;"
cmdTemp.CommandType = 1
Set cmdTemp.ActiveConnection = Session("RanFax")
T_Docs.Open cmdTemp, , 1,3
i = 0
do while not T_Docs.EOF
'fill the combo box%>
<OPTION value="<%=i%>"><%=T_Docs("SupplierCode")%>
<%T_Docs.MoveNext%>
<%i = i + 1%>
<%loop%>
<%T_Docs.Close%>
</SELECT>
-
Thanks for the reply mark. This works perfectly.
Lenin