Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 02:20 PM
Lisa
Guest
 
Posts: n/a
Default 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.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
  #2  
Old July 19th, 2005, 02:20 PM
Curt_C [MVP]
Guest
 
Posts: n/a
Default Re: Getting dropdown value

SelectedItem.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.0407220550.3618614e@posting.google.c om...[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.frmSoftware.cdoProject.options[cdoProject.selectedIndex].value[color=blue]
>
> //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[/color]


  #3  
Old July 19th, 2005, 02:20 PM
Curt_C [MVP]
Guest
 
Posts: n/a
Default 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.formname.cdoProject.value
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("cdoProject") 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.0407220550.3618614e@posting.google.c om...[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.frmSoftware.cdoProject.options[cdoProject.selectedIndex].value[color=blue]
>
> //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[/color]


  #4  
Old July 19th, 2005, 02:20 PM
Lisa
Guest
 
Posts: n/a
Default 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.frmSoftware.action =
> > "Process.asp?Developer=<%=Request.Form("cdoProject ")%>";
> > document.frmSoftware.submit();[/color][/color]
[color=blue][color=green]
> > 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>[/color][/color]
  #5  
Old July 19th, 2005, 02:21 PM
Curt_C [MVP]
Guest
 
Posts: n/a
Default 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.0407220949.47191dd7@posting.google.c om...[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.frmSoftware.action =
> > > "Process.asp?Developer=<%=Request.Form("cdoProject ")%>";
> > > document.frmSoftware.submit();[/color][/color]
>[color=green][color=darkred]
> > > 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>[/color][/color][/color]


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles