Getting dropdown value

Discussion in 'ASP General' started by Lisa, Jul 22, 2004.

  1. Lisa

    Lisa Guest

    I know this is supposed to be easy but I can't get this to work. I
    have a dropdown that pulls all the Projects (tp_title) available. All
    I want to do is get the ID (tp_id) of that record so I can get the
    developer assigned to that project (tp_assigned_to). Then, when I get
    the developer, I need that to be redirected to a second page.

    Example Code:
    ......
    function getProject(){
    //I know that this gets the selected value of the dropdown
    var cdoProject = document.frmSoftware.cdoProject.options[cdoProject.selectedIndex].value

    //but how do I get tp_id to get tp_assigned_to?????

    }


    function Submit(){
    document.frmSoftware.action =
    "Process.asp?Developer=<%=Request.Form("XXX")%>";
    document.frmSoftware.submit();
    }
    ....
    <form name="frmSoftware" method="post">
    .....

    Set cmd.ActiveConnection = oConn
    cmd.CommandText = "SELECT tp_id, tp_title, tp_assigned_to FROM
    Projects;"
    Set rs = cmd.execute
    ........
    <select size="1" id="cdoProject" name="cdoProject"
    onchange="javascript:getProject()">
    <option value="SELECT">SELECT</option>
    <%
    Dim id, vProject
    'EXECUTING- STORED QUERY- "SERVER_DROPDOWN"
    Do until swss.EOF
    id = swss.Fields("tp_id").value
    vProject = swss.Field("tp_title").value
    Response.Write "<option value=""" & vProject & """" & vProject &
    "</option>"
    swss.movenext
    loop
    swss.close
    Set swss = Nothing
    %>
    </select>
    <input type="button" value="Submit" name="btnSubmit"
    onclick="Submit()">

    Thanks in advance
    Lisa
    Lisa, Jul 22, 2004
    #1
    1. Advertising

  2. Lisa

    Lisa Guest

    Curt,
    Yeah I tried that already and it didn't work the value of cdoProject
    is blank- unless I have the syntax wrong?


    > > function Submit(){
    > > document.frmSoftware.action =
    > > "Process.asp?Developer=<%=Request.Form("cdoProject")%>";
    > > document.frmSoftware.submit();


    > > Set cmd.ActiveConnection = oConn
    > > cmd.CommandText = "SELECT tp_id, tp_title, tp_assigned_to FROM
    > > Projects;"
    > > Set rs = cmd.execute
    > > .......
    > > <select size="1" id="cdoProject" name="cdoProject"
    > > onchange="javascript:getProject()">
    > > <option value="SELECT">SELECT</option>
    > > <%
    > > Dim id, vProject
    > > 'EXECUTING- STORED QUERY- "SERVER_DROPDOWN"
    > > Do until swss.EOF
    > > id = swss.Fields("tp_id").value
    > > vProject = swss.Field("tp_title").value
    > > Response.Write "<option value=""" & id & """" & vProject &
    > > "</option>"
    > > swss.movenext
    > > loop
    > > swss.close
    > > Set swss = Nothing
    > > %>
    > > </select>
    Lisa, Jul 22, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vishnu
    Replies:
    1
    Views:
    1,202
    Patrick.O.Ige
    Mar 25, 2006
  2. Mike
    Replies:
    1
    Views:
    802
  3. =?Utf-8?B?VEpIZXJtYW4=?=

    Getting value of field in dropdown datasource within Formview

    =?Utf-8?B?VEpIZXJtYW4=?=, Jun 19, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    589
    =?Utf-8?B?VEpIZXJtYW4=?=
    Jun 19, 2006
  4. acadam
    Replies:
    0
    Views:
    754
    acadam
    Dec 27, 2006
  5. TJHerman

    Getting value of field in Dropdown List within Formview

    TJHerman, Jun 19, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    168
    TJHerman
    Jun 19, 2006
Loading...

Share This Page