|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
dropdown value wont change
Hi!
I have created a code for 2 dynamic drop boxes, the code works fine, the only problem is when a user changes the value of the 1st drop down box value remains the same by default. I have tried a lot to overcome this silly bug but.....##@ THE CODE!!---FILE NAME---select1.asp <% Dim oRs, conn, connect, strSQL %> <html> <head> <title>combo box</title> <!--#include file="../Connect/setconnection.asp" --> <script language="javascript"> <!-- function dept_onchange(frmSelect) { frmSelect.submit(); } //--> </script> </head> <body> The following was selected : <%ab =Request.Form ("courses") response.write ab Set rs=Server.CreateObject("adodb.recordset") mysql="select * from subcat where PIC_TYPE='"& ab &"' " rs.Open mysql, conn %> <select> <%do while not rs.eof%> <option><%=rs("SC_CNAME")%></option> <%rs.movenext loop%> </select> <form name="frmSelect" method="Post" action="select1.asp"> <SELECT name='courses' LANGUAGE=javascript onchange="return dept_onchange(frmSelect)"> <% Set oRs=Server.CreateObject("adodb.recordset") strSQL = "SELECT type_id,TYPE_NAME from TYPES order by type_id desc" oRs.Open strSQL, conn Do while not oRs.EOF 'varc=oRs("TYPE_ID") if Request.Form("courses") = oRs("TYPE_ID") then 'if this is the selected one then display as selected Response.Write "<OPTION VALUE = '" & oRS ("TYPE_ID") & "' selected >" Response.Write oRs("TYPE_ID") & "</Option>" oRs.MoveNext else Response.Write "<OPTION VALUE = '" & oRs ("TYPE_ID") & "' >" Response.Write oRs("TYPE_ID") & "</Option>" oRs.MoveNext end if loop %> </SELECT> </form> </body> </html> ---------------- The code works too good with CHAR but not with int as type_id is a int. Please please help.. I have gone throu the code whole night but all was in vein.. PLEASE PLEASE help.. Thanx a lot |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > dropdown value wont change |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|