Getting dropdown value

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lisa

    Getting dropdown value

    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.frmSof tware.cdoProjec t.options[cdoProject.sele ctedIndex].value

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

    }


    function Submit(){
    document.frmSof tware.action =
    "Process.asp?De veloper=<%=Requ est.Form("XXX") %>";
    document.frmSof tware.submit();
    }
    ....
    <form name="frmSoftwa re" method="post">
    .....

    Set cmd.ActiveConne ction = oConn
    cmd.CommandText = "SELECT tp_id, tp_title, tp_assigned_to FROM
    Projects;"
    Set rs = cmd.execute
    ........
    <select size="1" id="cdoProject " name="cdoProjec t"
    onchange="javas cript:getProjec t()">
    <option value="SELECT"> SELECT</option>
    <%
    Dim id, vProject
    'EXECUTING- STORED QUERY- "SERVER_DROPDOW N"
    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
  • Curt_C [MVP]

    #2
    Re: Getting dropdown value

    SelectedItem.Va lue


    --
    Curt Christianson
    Owner/Lead Developer, DF-Software
    Site: http://www.Darkfalz.com
    Blog: http://blog.Darkfalz.com


    "Lisa" <peashoe@yahoo. com> wrote in message
    news:8949b7ca.0 407220550.36186 14e@posting.goo gle.com...[color=blue]
    > 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 =[/color]
    document.frmSof tware.cdoProjec t.options[cdoProject.sele ctedIndex].value[color=blue]
    >
    > //but how do I get tp_id to get tp_assigned_to? ????
    >
    > }
    >
    >
    > function Submit(){
    > document.frmSof tware.action =
    > "Process.asp?De veloper=<%=Requ est.Form("XXX") %>";
    > document.frmSof tware.submit();
    > }
    > ...
    > <form name="frmSoftwa re" method="post">
    > ....
    >
    > Set cmd.ActiveConne ction = oConn
    > cmd.CommandText = "SELECT tp_id, tp_title, tp_assigned_to FROM
    > Projects;"
    > Set rs = cmd.execute
    > .......
    > <select size="1" id="cdoProject " name="cdoProjec t"
    > onchange="javas cript:getProjec t()">
    > <option value="SELECT"> SELECT</option>
    > <%
    > Dim id, vProject
    > 'EXECUTING- STORED QUERY- "SERVER_DROPDOW N"
    > 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[/color]


    Comment

    • Curt_C [MVP]

      #3
      Re: Getting dropdown value

      Woops....sorry, was in .NET mode.

      You are trying to get this in CLIENTside code so this isn't really the best
      place but it should be something like
      document.formna me.cdoProject.v alue
      At least I thought so.... I'd suggest hitting a clientside/javascript group
      though

      If I misread and you are trying ot get this serverside them just make sure
      your dropdown uses the ID as the value and the NAME as the text for the
      dropdown/select. Then just use Request.Form("c doProject") to get the value.

      --
      Curt Christianson
      Owner/Lead Developer, DF-Software
      Site: http://www.Darkfalz.com
      Blog: http://blog.Darkfalz.com


      "Lisa" <peashoe@yahoo. com> wrote in message
      news:8949b7ca.0 407220550.36186 14e@posting.goo gle.com...[color=blue]
      > 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 =[/color]
      document.frmSof tware.cdoProjec t.options[cdoProject.sele ctedIndex].value[color=blue]
      >
      > //but how do I get tp_id to get tp_assigned_to? ????
      >
      > }
      >
      >
      > function Submit(){
      > document.frmSof tware.action =
      > "Process.asp?De veloper=<%=Requ est.Form("XXX") %>";
      > document.frmSof tware.submit();
      > }
      > ...
      > <form name="frmSoftwa re" method="post">
      > ....
      >
      > Set cmd.ActiveConne ction = oConn
      > cmd.CommandText = "SELECT tp_id, tp_title, tp_assigned_to FROM
      > Projects;"
      > Set rs = cmd.execute
      > .......
      > <select size="1" id="cdoProject " name="cdoProjec t"
      > onchange="javas cript:getProjec t()">
      > <option value="SELECT"> SELECT</option>
      > <%
      > Dim id, vProject
      > 'EXECUTING- STORED QUERY- "SERVER_DROPDOW N"
      > 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[/color]


      Comment

      • Lisa

        #4
        Re: Getting dropdown value

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

        [color=blue][color=green]
        > > function Submit(){
        > > document.frmSof tware.action =
        > > "Process.asp?De veloper=<%=Requ est.Form("cdoPr oject")%>";
        > > document.frmSof tware.submit();[/color][/color]
        [color=blue][color=green]
        > > Set cmd.ActiveConne ction = oConn
        > > cmd.CommandText = "SELECT tp_id, tp_title, tp_assigned_to FROM
        > > Projects;"
        > > Set rs = cmd.execute
        > > .......
        > > <select size="1" id="cdoProject " name="cdoProjec t"
        > > onchange="javas cript:getProjec t()">
        > > <option value="SELECT"> SELECT</option>
        > > <%
        > > Dim id, vProject
        > > 'EXECUTING- STORED QUERY- "SERVER_DROPDOW N"
        > > 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>[/color][/color]

        Comment

        • Curt_C [MVP]

          #5
          Re: Getting dropdown value

          its your Select tag most likely...
          do you have value attributes on each of the items in the select tag?

          --
          Curt Christianson
          Owner/Lead Developer, DF-Software
          Site: http://www.Darkfalz.com
          Blog: http://blog.Darkfalz.com


          "Lisa" <peashoe@yahoo. com> wrote in message
          news:8949b7ca.0 407220949.47191 dd7@posting.goo gle.com...[color=blue]
          > Curt,
          > Yeah I tried that already and it didn't work the value of cdoProject
          > is blank- unless I have the syntax wrong?
          >
          >[color=green][color=darkred]
          > > > function Submit(){
          > > > document.frmSof tware.action =
          > > > "Process.asp?De veloper=<%=Requ est.Form("cdoPr oject")%>";
          > > > document.frmSof tware.submit();[/color][/color]
          >[color=green][color=darkred]
          > > > Set cmd.ActiveConne ction = oConn
          > > > cmd.CommandText = "SELECT tp_id, tp_title, tp_assigned_to FROM
          > > > Projects;"
          > > > Set rs = cmd.execute
          > > > .......
          > > > <select size="1" id="cdoProject " name="cdoProjec t"
          > > > onchange="javas cript:getProjec t()">
          > > > <option value="SELECT"> SELECT</option>
          > > > <%
          > > > Dim id, vProject
          > > > 'EXECUTING- STORED QUERY- "SERVER_DROPDOW N"
          > > > 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>[/color][/color][/color]


          Comment

          Working...