...

View Full Version : onChange reload to link



ynotlim
12-01-2006, 11:14 PM
Hello...

I have this select input and onchange I want it to go to a specific link. Here's what I want it to do but not sure how


<SELECT Name="tape_type" VALUE="" onChange="window.location.href=tape.cgi?tape_type=$in{'$tape_type'}">
<OPTION>--</OPTION>
<OPTION VALUE='ADV'>ADV
<OPTION VALUE='APP'>APP
<OPTION VALUE='ATF'>ATF
<OPTION VALUE='CEEB'>CEEB
</SELECT>

It needs to go to the same page, but have the value stored in $tape_type added to the link. How do I assign the link??

Thank you in advance

david_kw
12-01-2006, 11:26 PM
Something like:




window.location.href="tape.cgi?tape_type="+document.tape_type.options[document.tape_type.selectedIndex].value;


You might have to put the form name in that as well. I didn't test it. Also the .value might be .text if doesn't work.

david_kw

ynotlim
12-01-2006, 11:44 PM
Thank you David, but i can't get it to work. Here is what i'm using and it still isn't working.


<FORM NAME="tape_type" METHOD="POST">
<SELECT Name="tape_type" VALUE="" id="tape_type"
onChange="window.location.href="edfstatus_dev.cgi?amode=input&tape_type="+document.tape_type.options[document.tape_type.selectedIndex].text"">
<OPTION>--</OPTION>
<OPTION VALUE='ADV'>ADV
<OPTION VALUE='APP'>APP
<OPTION VALUE='ATF'>ATF
<OPTION VALUE='CEEB'>CEEB
</SELECT>
</FORM>

david_kw
12-02-2006, 12:18 AM
Oops sorry. I caused quote problems for ya.

Try:



<FORM NAME="tape_type_form" METHOD="POST">
<SELECT Name="tape_type" VALUE="" id="tape_type"
onChange="window.location.href='edfstatus_dev.cgi?amode=input&tape_type='+document.tape_type_form.tape_type.options[document.tape_type_form.tape_type.selectedIndex].text">
<OPTION>--</OPTION>
<OPTION VALUE='ADV'>ADV
<OPTION VALUE='APP'>APP
<OPTION VALUE='ATF'>ATF
<OPTION VALUE='CEEB'>CEEB
</SELECT>
</FORM>


david_kw



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum