Click to See Complete Forum and Search --> : dynamic dropdown boxes


simflex
01-02-2003, 09:18 AM
I have two fields on my db.
One is called CVTypes and the other is called CVNames.
I need to have two dynamic dropdown boxes that allows users to select CV types and CV names from the dropdowns.

How can I do that with this code?
Thanks in advance

Here is code snippet:

<TR>
<TD>CV Type:</TD>
<TD>
<%
dim con
set con = server.createobject("ADODB.Connection")
dim rs
set rs = server.createobject("ADODB.Recordset")
con.open ("DSN=cvs")
rs.open "SELECT * FROM CVs", con
%>
<SELECT name="theSelect">
<OPTION value=none>--Select One--</OPTION>
<%
while not rs.eof
response.write("<OPTION value=" & rs("taskid") & ">")
response.write(rs("CVType") & "</OPTION>")
rs.movenext
wend
set rs = nothing
set con = nothing
%>
</SELECT>
</TD>
</TR>

simflex
01-02-2003, 01:44 PM
hello!!!

vishu_gupt
01-06-2003, 10:35 AM
Originally posted by simflex
I have two fields on my db.
One is called CVTypes and the other is called CVNames.
I need to have two dynamic dropdown boxes that allows users to select CV types and CV names from the dropdowns.

How can I do that with this code?
Thanks in advance

Here is code snippet:

<TR>
<TD>CV Type:</TD>
<TD>
<%
dim con
set con = server.createobject("ADODB.Connection")
dim rs
set rs = server.createobject("ADODB.Recordset")
con.open ("DSN=cvs")
rs.open "SELECT * FROM CVs", con
%>
<SELECT name="theSelect">
<OPTION value=none>--Select One--</OPTION>
<%
while not rs.eof
response.write("<OPTION value=" & rs("taskid") & ">")
response.write(rs("CVType") & "</OPTION>")
rs.movenext
wend
set rs = nothing
set con = nothing
%>
</SELECT>
</TD>
</TR>

Use the following code snippet:

<TR>
<TD>CV Type:</TD>
<TD>
<%
dim con
set con = server.createobject("ADODB.Connection")
dim rs
set rs = server.createobject("ADODB.Recordset")
con.open ("DSN=cvs")
rs.open "SELECT * FROM CVs", con
strCVtype=""
strCVname=""
while not rs.eof
strCVtype=strCVtype & "<OPTION value=" & rs("taskid") ">"
& rs("CVType") & "</OPTION>"
strCVname=strCVname & "<OPTION value=" & rs("taskid") ">"
& rs("CVName") & "</OPTION>"
rs.movenext
wend
set rs = nothing
set con = nothing
%>
<SELECT name="TypeSelect">
<OPTION value=none>--Select One--</OPTION>
<%=strCVtype%>
</SELECT>
<SELECT name="NameSelect">
<OPTION value=none>--Select One--</OPTION>
<%=strCVname%>
</SELECT>
</TD>
</TR>
--
<b>Vishal </b>

tasneem
01-06-2003, 03:50 PM
I have a similar request, with the change that people should select from one drop down box and the results should be in a table form.
thnks

vishu_gupt
01-07-2003, 06:07 AM
Originally posted by tasneem
I have a similar request, with the change that people should select from one drop down box and the results should be in a table form.
thnks

:) What you can do is, Write a Javascript function which submits the form back to the same URl and call this function on "OnClick" even of the Dropdown. Now when that function will get a call then you will get the value of the selected option in dropdown and based on that value you can show the details in a Table Form.