In the code I have 2 ddlists. The first ddl is populated by SQL db tables the second also has a value from the db and it's remaining options are generated by the javascript. Is there a way to get the "SubStatus" recordset return in the drop down list to display? Only the Javascript ddlist shows but not the recordset return (line 62 in code) I realize this is a client and server side issue, but I don't know what to do to get rs("SubStatus") to display. Here's the code...
CODE
<%
'rs recordset returns the Status and Substatus from sql db
'PREPOP Sub
sqlstring = "select * from subs"
set rs1 = objConn.execute(sqlstring)
x=0 %>
<script language = "JavaScript">
function sublist(inform, selecteditem)
{
inform.SubStatus.length = 0
var dbsubstatus = "<%= rs("SubStatus") %>"
var dbstatus = "<%= rs("Status") %>"
<%
count= 0
y=0
do while not rs1.eof
%>
x = <%= trim(y) %>
subcat = new Array();
subcatagorys = "<%= trim(rs1("SubStatus"))%>"
subcatagoryof = "<%= trim(rs1("StatusCode"))%>"
subcat[x,0] = subcatagorys;
subcat[x,1] = subcatagoryof;
if (subcat[x,1] == selecteditem)
{
var option = new Option(subcat[x,0], subcat[x,2]);
inform.SubStatus.options[inform.SubStatus.length]=option;
}
<%
count = count + 1
y = y + 1
rs1.movenext
loop
%>
}
</script>
<BODY onLoad = "sublist(document.reqform,document.reqform.status[document.reqform.status.selectedIndex].value)">
<form action="RequestUpdate.asp" method="post" name="reqform">
<%
cat = Request.QueryString("cat")
sqlstring2 = "SELECT Distinct StatusCode from subs"
set rs2 = objConn.execute (sqlstring2)
%>
<p>Status:
<SELECT id=status name=status onChange="java script:sublist(this.form, document.reqform.status[document.reqform.status.selectedIndex].value)">
<option value="<%= rs("Status") %>"><%= rs("Status") %></option>
<%
do until rs2.eof
%>
<OPTION value="<%= rs2("StatusCode")%>"><% = rs2("StatusCode")%></OPTION>
<%
rs2.movenext
loop
set rs2 = nothing
%>
</SELECT>
</p>
<p>Sub Status
<SELECT id =SubStatus name=SubStatus>
<Option selected value="<%= rs("SubStatus") %>"><%= rs("SubStatus") %></option>
</SELECT>
</p>