First join JS-Jive at http://groups.yahoo.com/group/JS-Jive for all the
Javascript help you can stand. But to answer your question, your best bet is
to control the forms action depending on how the form in submitted (either
through the submit button or the onchange event of the select box). You can
find some good information on how to do this here...
http://developer.irt.org/script/form.htm#7.2.

HTH,
Steve

"S R" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
Hi Everyone,

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.  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 <form> 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, but I probably could do
it through Javascript. Any help will do.

Thanks

 function openURL(){
 // grab index number of the selected option
 selInd = document.myForm.CompanyID2.selectedIndex;

 // get value of the selected option
 goURL = document.myForm.CompanyID2.options[selInd].value;

 // redirect browser to the grabbed value (hopefully a URL)
 top.location.href = goURL;
}
// end hiding script-->

  <cfoutput><select name="CompanyID2" onchange="openURL()"></cfoutput>
            <option value=""></option>
   <cfoutput query="GetCompanies">
            <option value="index.cfm?ID=#ID#" <cfif IsDefined("ThisVar") AND
FORM.CompanyID2 IS NOT ''><cfif GetCompanies.ID IS
FORM.CompanyID2>selected</cfif></cfif>>#CompanyName#</option>
   </cfoutput>
          </select>



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

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to