dcsimg
www.webdeveloper.com
Results 1 to 5 of 5

Thread: dynamic dropdown boxes

  1. #1
    Join Date
    Dec 2002
    Posts
    316

    dynamic dropdown boxes

    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>

  2. #2
    Join Date
    Dec 2002
    Posts
    316
    hello!!!

  3. #3
    Join Date
    Dec 2002
    Posts
    54

    Re: dynamic dropdown boxes

    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>

  4. #4
    Join Date
    Dec 2002
    Posts
    213

    drop down box

    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

  5. #5
    Join Date
    Dec 2002
    Posts
    54

    Lightbulb Re: drop down box

    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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles