hi, am an absolute newbie,
i have 2 dropdown menus. when the first one is clicked the 2nd one should be populated with values from recordset. The problem is when the page is displayed both the dropdowns should be visible. So far have written the below code please help me debug this. it just does not work !!!!
================
<%
Dim ConLog 'For Opening Connection to Db
Dim rs 'For RecordsSet
Dim aryClt
Set ConLog = Server.CreateObject("adodb.connection"
Set rs = Server.CreateObject("ADODB.Recordset"
ConLog.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\inetpub\rs.Open "select distinct cod_client from corp_2002 where left(cod_client,1)='A'",ConLog
aryClt = rs.GetRows()
Response.Write("Conn estb...."
Response.Write("<Script Language=JavaScript>"
Response.Write("<!--"
Response.Write("function PopulateOptions(){" & chr(13))
Response.Write("Conn estb 123...."
Response.Write("x= 0"
Response.Write("for x=0 to ubound(aryclt,2)"
Response.Write(" sSelect = sSelect + '<OPTION VALUE=' + aryClt(1,x) + '>' + aryClt(0,x) + '</OPTION>'" & chr(13))
Response.Write("Next"
Response.Write(" document.all['fill'].innerHTML = sSelect;" & chr(13))
Response.Write("}"
Response.Write("-->"
Response.Write("</Script>"
%>
<html>
<body>
<form method="post" action="results.asp">
<P><select name="reptype" size="1" onChange=PopulateOptions()>
<OPTION VALUE="none" SELECTED="Selected">Select Report Type</option>
<OPTION VALUE="Location">Location Wise</option>
<OPTION VALUE="Corp">Corp Code Wise</option>
</select></P>
<P>
<SPAN Id=fill>
<select name="cmbFill" size="1">
<option value=0 selected></option>
</select>
</span>
</P>
<P>
<input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2">
</P>
</form>
</body>
</html>
=========================
You can also mail me at kniraj@hotmail.com if u need the database, but in a plain asp code the "for loop" in bold works fine to display data.
PS. Also if u can direct me to some site showing how to use JS and ASP together, it would be of great help.
Regards
Niraj![[noevil] [noevil] [noevil]](/data/assets/smilies/noevil.gif)
i have 2 dropdown menus. when the first one is clicked the 2nd one should be populated with values from recordset. The problem is when the page is displayed both the dropdowns should be visible. So far have written the below code please help me debug this. it just does not work !!!!
================
<%
Dim ConLog 'For Opening Connection to Db
Dim rs 'For RecordsSet
Dim aryClt
Set ConLog = Server.CreateObject("adodb.connection"
Set rs = Server.CreateObject("ADODB.Recordset"
ConLog.Open "Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\inetpub\rs.Open "select distinct cod_client from corp_2002 where left(cod_client,1)='A'",ConLog
aryClt = rs.GetRows()
Response.Write("Conn estb...."
Response.Write("<Script Language=JavaScript>"
Response.Write("<!--"
Response.Write("function PopulateOptions(){" & chr(13))
Response.Write("Conn estb 123...."
Response.Write("x= 0"
Response.Write("for x=0 to ubound(aryclt,2)"
Response.Write(" sSelect = sSelect + '<OPTION VALUE=' + aryClt(1,x) + '>' + aryClt(0,x) + '</OPTION>'" & chr(13))
Response.Write("Next"
Response.Write(" document.all['fill'].innerHTML = sSelect;" & chr(13))
Response.Write("}"
Response.Write("-->"
Response.Write("</Script>"
%>
<html>
<body>
<form method="post" action="results.asp">
<P><select name="reptype" size="1" onChange=PopulateOptions()>
<OPTION VALUE="none" SELECTED="Selected">Select Report Type</option>
<OPTION VALUE="Location">Location Wise</option>
<OPTION VALUE="Corp">Corp Code Wise</option>
</select></P>
<P>
<SPAN Id=fill>
<select name="cmbFill" size="1">
<option value=0 selected></option>
</select>
</span>
</P>
<P>
<input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2">
</P>
</form>
</body>
</html>
=========================
You can also mail me at kniraj@hotmail.com if u need the database, but in a plain asp code the "for loop" in bold works fine to display data.
PS. Also if u can direct me to some site showing how to use JS and ASP together, it would be of great help.
Regards
Niraj
![[noevil] [noevil] [noevil]](/data/assets/smilies/noevil.gif)