<html><DIV>Hi Everyone,</DIV>
<DIV>&nbsp;</DIV>
<DIV>I've been staring at my code to long and I'm stumped. I have a select menu (see 
below) that is being populated from a databse.&nbsp; My problem is, if a user chooses 
an option from the pull down menu it needs to also send the rest of my form variables 
to the next page. Right now, using the 'onChange' handler, its only send the ID 
variable within the 'option' tag. Now I know I can use the 'this.form.submit()' to 
accomplish this but I cannot use it because I need the page to go somewhere different 
when they press 'submit'. What would be cool is if I could dynamically change the 
&lt;form&gt; tag to go one place when they click submit and another if they choose an 
option from the pull down menu. I'm not well versed in Javascript,&nbsp;but I probably 
could do it through Javascript. Any help will do.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;function openURL(){ </DIV>
<DIV>&nbsp;// grab index number of the selected option<BR>&nbsp;selInd = 
document.myForm.CompanyID2.selectedIndex; <BR>&nbsp;<BR>&nbsp;// get value of the 
selected option<BR>&nbsp;goURL = 
document.myForm.CompanyID2.options[selInd].value;<BR>&nbsp;<BR>&nbsp;// redirect 
browser to the grabbed value (hopefully a URL)<BR>&nbsp;top.location.href = goURL; 
<BR>}<BR>// end hiding script--&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&lt;cfoutput&gt;&lt;select name="CompanyID2" 
onchange="openURL()"&gt;&lt;/cfoutput&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &lt;option value=""&gt;&lt;/option&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;cfoutput 
query="GetCompanies"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &lt;option value="index.cfm?ID=#ID#" &lt;cfif IsDefined("ThisVar") AND 
FORM.CompanyID2 IS NOT ''&gt;&lt;cfif GetCompanies.ID IS 
FORM.CompanyID2&gt;selected&lt;/cfif&gt;&lt;/cfif&gt;&gt;#CompanyName#&lt;/option&gt;<BR>&nbsp;&nbsp;&nbsp;&lt;/cfoutput&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 &lt;/select&gt;</DIV><br clear=all><hr>Get your FREE download of MSN Explorer at <a 
href="http://explorer.msn.com";>http://explorer.msn.com</a><br></p></html>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to