dropdown question in ASP -- please help!
Hi, I have a question with dropdown list in ASP. When I click "inactiv" option, the page does not show inactive list. Is there anyone can help me with the code? It has been bothered me for 2 days. Thank you so much. Here is my code:
<%
Dim intActive
intActive = request("ddlactive")
if intActive = "1" then
Set cnnApp = OpenDB()
Set cmdApp = Server.CreateObject("ADODB.Command")
With cmdApp
.ActiveConnection = cnnApp
.CommandType = adCmdStoredProc
.CommandText = "active_list"
Set rstApp = .Execute
End With
else
Set cnnApp = OpenDB()
Set cmdApp = Server.CreateObject("ADODB.Command")
With cmdApp
.ActiveConnection = cnnApp
.CommandType = adCmdStoredProc
.CommandText = "inactive_list"
Set rstApp = .Execute
End With
end if
Set rstApp.ActiveConnection = Nothing
CloseDB cnnApp
Set cmdApp = Nothing
%>
<Script Language=JavaScript>
function validate(thebutton)
{
document.frmapplst.submit();
if (theButton.name=='s1')
document.frmapplst.action='/list.asp?ddlactive='+ document.frmapplst.ddlactive.options[document.frmapplst.ddlactive.selectedIndex].value;
}
</Script>
<FORM NAME="frmapplst" method="post">
Please select: <select name="ddlactive">
<option value="1" >Active</option>
<option value="0" > Inactive</option>
</select>
<input type="button" name="s1" value="Submit" onClick="validate(this)">
</form>
|