Click to See Complete Forum and Search --> : Need help with saving value of Drop Down


nitekchris
02-02-2005, 05:22 PM
Hello,

I am hoping some one can assist me with an issue I can not figure out. I am running two SQL queries on a page. 1 finds a user name, then you are given two radio buttons to choose from. Once you click on one of the radio buttons you are presented with a drop down that is populated from the second query. I need to be able to click on one of the drop down items and get the value to populate into a form. For the life of me I have not been able to get it to work.

Here is the code that I have for the drop down that gets populated:

<SELECT name="DIOdd" ID="DIOdd" action="document.FrmMain1.submit();">
<OPTION value="">&lt;Please Select Building&gt;</OPTION>
<% do until (o_DIO.EOF) %>
<OPTION value="<%=trim(o_DIO("DIOdn")) %>"><%=trim(o_DIO("DIOdn")) %>
</OPTION>
<% o_DIO.MoveNext()
loop %>
</SELECT>

How can I get the value of the item that is picked.
Thank you for your help in advance.

CJ

lmf232s
02-02-2005, 06:29 PM
MyValue = Request.form("DIOdd")

you will have to trigger this with a trip to the server.

lmf232s
02-02-2005, 06:32 PM
ok i see that you are submiting the page when you choose a value.
If the form you want to populate is on another page then, it will depend on if you are using Get or Post to submit the form.

MyValue = Request.form("DIOdd")
or
MyValue = request.querystring("DIOdd")

nitekchris
02-02-2005, 06:46 PM
Well I guess I am doing something wrong. Right now I am just trying to get an alert so that i know there is a value.
This is what I have been trying:

<SELECT name="DIOdd" ID="DIOdd" onchange="showDD();">
<OPTION value="">&lt;Please Select Building&gt;</OPTION>
<% do until (o_DIO.EOF) %>
<OPTION value="<%=trim(o_DIO("DIOdn")) %>"><%=trim(o_DIO("DIOdn")) %>
</OPTION>
<% o_DIO.MoveNext()
loop %>
</SELECT>
<input type='Hidden' id='sIndex' name='sIndex' />
</p>

and then I am trying this function to show me the value.

<script language=javascript>
function showDD()
{

DDvalue =Request.formmain1("DIOdd")
window.alert(DDvalue)
}

nitekchris
02-02-2005, 06:55 PM
I don't think I am being to clear in my explanation, sorry about that.

What I am trying to do is when the item is selected in the drop down, it will then populate a field in a form. The drop down is a list of email alias's. Once you click an item from the drop down a form is then presented for the user to fill out showing who it will be mailed to (the one you selected). Then when they submit the form I will be carrying that value to a second page.

Hope this helps.

lmf232s
02-02-2005, 08:36 PM
<script language=javascript>
function showDD(){
alert("I made it");
alert(document.form.DIOdd.value);
}
</script>

this should do it for you. then to populate another textbox or something similar then something like this would work.
add this into the javascript

document.form.txtTest.value = document.form.DIOdd.value;

of course you will need to rename txtTest to something that exists or it will error out and i am asuming your form name is form which it most likely is not so change form to what ever you called your form.

Hope that helps. Let me know if you need more

nitekchris
02-03-2005, 12:59 PM
Thank you very much, that did it.