Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drop dwon list help

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Question
I made a drop down list and I have three problems
1- in drop down list I want it to begin with “ chose from the list” it is empty now
how to do this
2- the select statement is showing is the page which is “Select movies.title,released…….”
How to get red of it
3- I don’t want the table header to appear till someone chose from the list

-----

<html>
<H1>Movies Genres list</H1>

<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly=0
adLockReadOnly=1
adCmdTable=2
adCmdText=1

Dim objConn, GenRS, GenSQL, movgRS, movgSQL, vGENRE, movRS
Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set GenRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Set movgRS = Server.CreateObject(&quot;ADODB.Recordset&quot;)


vGENRE = request.form(&quot;DeptPicked&quot;)



objConn.Open &quot;Provider=MSDAORA.1;User ID=id;Password=pas;&quot;

GenSQL = &quot;Select * from genres order by genre&quot;
movgSQL = &quot;Select movies.title,released where genre='&quot; & vGENRE & &quot;'&quot;



GenRS.open GenSQL, objConn, adOpenForwardOnly, adLockReadOnly, AdCmdText
movgRS.open movgSQL, objConn, adOpenForwardOnly, adLockReadOnly, AdCmdText

response.write &quot;<BR>&quot; & movgSQL & &quot;<BR>&quot;



response.write(&quot;<form action=' method='POST'>&quot;)
response.write(&quot;<select name='DeptPicked'>&quot;)
response.write(&quot;<option value=''></option>&quot;)
while not GenRS.eof
response.write(&quot;<option value='&quot; & GenRS(&quot;genre&quot;) & &quot;'>&quot; & GenRS(&quot;genre&quot;) & &quot;</option>&quot;)
GenRS.movenext
Wend
response.write(&quot;</select>&quot;)
response.write(&quot;<input type='submit' value='Retrieve Movies List'>&quot;)
response.write(&quot;</form>&quot;)
response.write(&quot;<BR> Movies List: &quot; & vGENRE & &quot;<BR>&quot;)
%>

<BIG>
<TABLE border=0 cellPadding=0 cellSpacing=2 height=0 width='76%'>
<TR>
<TD align=center width='55%' bgcolor='#FFFFCC' style=&quot;border-style: solid; border-width: 1&quot;><font color=&quot;#0000FF&quot;>
Title</font></TD>
<TD align=center width='19%' bgcolor='#FFFFCC' style=&quot;border-style: solid; border-width: 1&quot;><font color=&quot;#0000FF&quot;>Year
Released</font></TD>
<TD align=center width='14%' bgcolor='#FFFFCC' style=&quot;border-style: solid; border-width: 1&quot;><font color=&quot;#0000FF&quot;>
Rating</font></TD>
<TD align=center width='13%' bgcolor='#FFFFCC' style=&quot;border-style: solid; border-width: 1&quot;><font color=&quot;#0000FF&quot;>
Review</font></TD>
</TR>

<%
while not movgRS.eof
response.write(&quot;<TR>&quot;)
response.write(&quot;<TD>&quot; & movgRS(&quot;title&quot;) & &quot;</TD>&quot;)
response.write(&quot;<TD>&quot; & movgRS(&quot;released&quot;) & &quot;</TD>&quot;)
response.write(&quot;<TD>&quot; & movgRS(&quot;rating&quot;) & &quot;</TD>&quot;)
response.write(&quot;<TD>&quot; & movgRS(&quot;review&quot;) & &quot;</TD>&quot;)
response.write(&quot;</TR>&quot;)
movgRS.movenext
Wend
response.write(&quot;</table></BIG>&quot;)

GenRS.close
movgRS.close
objConn.close
Set GenRS = Nothing
Set movgRS = Nothing
Set objConn = Nothing
%>

<BR><HR>
</table>
</big>
</HTML>
 
hi, john if am not wrong then what u trying to di to populate the DropDown box at run time.... the below code i have written after weeks of trial and error, just drill thru the same and lemme know if it helps else write back. i believe the Table header prob will also be solved....
===========================
<%
Dim ConLog 'For Opening Connection to Db
Dim rs 'For RecordsSet
Dim aryClt
Dim sSelect

Set ConLog = Server.CreateObject(&quot;adodb.connection&quot;)
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
ConLog.Open &quot;Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\inetpub\rs.Open &quot;select distinct cod_client from corp_2002 where left(cod_client,1)='A'&quot;,ConLog
rs.movefirst
aryClt = rs.GetRows()
Response.Write(&quot;Conn estb....&quot;)
%>
<html>
<head>
<title>Options Page</title>
<Script Language=&quot;JavaScript&quot;>
function PopulateOptions() {
<%
x= 0
sSelect= &quot;<select name=cmbfill size=1 id=fill>&quot;
for x=0 to ubound(aryclt,2)
sSelect = sSelect & &quot;<OPTION>&quot; & aryClt(0,x) & &quot;</OPTION>&quot;
Next
sSelect = sSelect & &quot;</Select>&quot;
%>
document.all('fill').outerHTML = &quot;<%=sSelect%>&quot;
}
</Script>
</head>
<body>
<form method=&quot;post&quot; action=&quot;results.asp&quot; id=form1 name=form1>
<P><select name=&quot;reptype&quot; size=&quot;1&quot; onchange=PopulateOptions()>
<OPTION VALUE=&quot;none&quot; Selected>Select Report Type</option>
<OPTION VALUE=&quot;Location&quot;>Location Wise</option>
<OPTION VALUE=&quot;Corp&quot;>Corp Code Wise</option>
<OPTION VALUE=&quot;Cluster&quot;>Cluster Wise</option>
<OPTION VALUE=&quot;Product&quot;>Product Wise</OPTION>
</select></P>
<P>
</P>
<P>
<select name=&quot;cmbfill&quot; size=&quot;1&quot; id=&quot;fill&quot;>
<option value=0 selected>Choose From the List</option>
</select>

</P>
<P>
<input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B1&quot;>
<input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;B2&quot;>
</P>
</form>
</body>
</html>

[cheers]
Niraj [noevil]

PS: Change the Database and the Query String... before u execute
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top