|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need Help - Asp 2 Dropdown Box Onchange
Hi
Can anybody show me how to do 2 dropdown boxes which the second box will change the value according to the first drop box selection? I succesfully made the value change but the first drop box also changed to its initial value. Thanks in advance the attachment is my code.. |
|
#2
|
||||
|
||||
|
post ur code pls........
|
|
#3
|
|||
|
|||
|
here is my code...happy to tell me wat wrong with it.
This is part of the code ""
sqlManufac = "SELECT * from category order by category_id" if ProdTypeID = 0 then sqlSubCat = "SELECT * from sub_category order by sub_category_name" else sqlSubCat = "Select * from sub_category where ProductTypeID = " + prodTypeId + " order by sub_category_id" end if response.write(sqlSubCat) sqlCat = "SELECT * from product_type order by producttypeid" If cmd = "Add" Then sql = "select * from Product where Product_id = 0" Else sql = "select * from Product where Product_id = " & productID sql1 = "select * from Hardware_dimension where Product_id = " & productID Set rsDim = objConn.Execute(sql1) End If ' Get a Record Set set rsSubcat = objConn.Execute(sqlSubCat) Set rsCat = objConn.Execute(sqlCat) set rsManufac = objConn.Execute(sqlManufac) Set rs = objConn.Execute(sql) if (isnull(mainCatDesc) or mainCatDesc = "" ) and cmd <> "Add" then Do Until rsManufac.eof If rs("category_id") = rsManufac("category_id") Then mainCatDesc = rsManufac("category_name") catDescription = rsManufac("category_desc") End If rsManufac.movenext loop rsManufac.movefirst end if if (isnull(mainProdDesc) or mainProdDesc = "" )and cmd <> "Add" then Do Until rsCat.eof If rs("producttypeid") = rsCat("producttypeid") Then mainProdDesc = rsCat("producttypename") prodDescription = rsCat("producttype_desc") End If rsCat.movenext loop rsCat.movefirst end if 'mainProdDesc If cmd = "Add" Then %> <form name="form1" method="post" action="maintainHardware.asp" onSubmit="return hardwareValidate()" enctype="multipart/form-data"> <input type="hidden" name="cmd" value="add_save"> <% ElseIf cmd = "Edit" Then %> <form name="form1" method="post" action="maintainHardware.asp" onSubmit="return hardwareValidate()" enctype="multipart/form-data"> <input type="hidden" name="cmd" value="edit_save"> <input type="hidden" name="productID" value=<%=productID%>> <input type="hidden" name="imagePath" value='<%=rs("Product_Image")%>'> <input type="hidden" name="pdfPath" value='<%=rs("Product_pdf")%>' ID="Hidden7"> <% ElseIf cmd = "Delete" Then %> <form name="form1" method="post" action="maintainHardware.asp"> <input type="hidden" name="cmd" value="delete_save"> <input type="hidden" name="productID" value=<%=productID%>> <input type="hidden" name="imagePath" value='<%=rs("Product_Image")%>'> <% ElseIf cmd = "View" Then %> <form name="form1" method="post" action="searchHardware.asp"> <input type="hidden" name="cmd" value="View"> <% End If %> <p> </p> <p> </p> <p> </p> <table class=content border="5" width="654" cellspacing="0" cellpadding="0" height="280" align="center"> <tr class=contentrow1 align="center"> <td colspan="9" height="22"><b><%=cmd %> Hardware Product</b></td> </tr> <tr class=contentrow2 > <td colspan="9" height="260"> <table class=record width="100%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="30" height="33"> </td> <td width="82" height="33" align="right"><div align="right"><font size="-1"><strong>Product Type</strong></font></div></td> <td width="16" height="33" align="center"><font size="-1"><strong> :</strong></font></td> <td valign="center" height="33" colspan="4"> <% Select Case cmd Case "Add" %> <select name="prodtype" onchange="window.location='maintainHardware.asp?cmd=Add&cid=' + document.forms[0].prodtype.options[document.forms[0].prodtype.selectedIndex].value"> <% Do Until rsCat.eof If rsCat("producttype_desc") = mainCatDesc Then %> <option value=<%=Server.HTMLEncode(rsCat("producttypeid"))%> selected><%=rsCat("producttypename")%></option> <% Else %> <option value=<%=Server.HTMLEncode(rsCat("producttypeid"))%>><%=rsCat("producttypename")%></option> <% End If rsCat.movenext loop |
|
#4
|
||||
|
||||
|
try this........
<% Do Until rsCat.eof If rsCat("producttype_desc") = mainCatDesc Then %> <option value=<%=Server.HTMLEncode(rsCat("producttypeid"))%> if rsCat("producttypeid")=cid then response.write "selected"><%=rsCat("producttypename")%></option> <% Else %> <option value=<%=Server.HTMLEncode(rsCat("producttypeid"))%>if rsCat("producttypeid")=cid then response.write "selected"><%=rsCat("producttypename")%></option> <% End If rsCat.movenext loop |
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > Asp 2 Dropdown Box Onchange |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|