Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: define action path based on whats selected in dropdown menu


Message #1 by "Aaron sahlin" <aaronsahlin@y...> on Thu, 29 Aug 2002 22:22:46
Just change the form's action property based on your criteria:
if (myVariable = 1)
{
document.forms[0].action = "http://www.myFormProcessor.asp";
}
else
{
  document.forms[0].action = "http://www.myOtherFormProcessor.asp";
}
document.forms[0].submit();


Will submit the first form on the page to different asp pages on the server.

Joe
>From: bopardikar@q...
>Reply-To: "javascript" <javascript@p...>
>To: "javascript" <javascript@p...>
>Subject: [javascript] Re: define action path based on whats selected in 
>dropdown menu
>Date: Sat, 31 Aug 2002 00:38:56
>
> > I have a form in html that has different action items specified in it.
>Is there a way to specify what
>s> ervlet the action goes to by what is selected?  Or is there one servlet
>specified for a form and thats it.
>
> > Basically I want to send certain actions to one servlet and some to a
>different servlet.  Is this possible
>w> ith javascript / html?
>
>Hi Aaron,
>
>I had a similar problem and i solved it by putting a page on the
>server that would perform the required redirection... so the form submits
>to this page and the page on the server decides where to redirect
>
>I am not aware of any way we can do it on the client end and change the
>action attribute dynamically. That would be interesting to know!!
>
>regards,
>Arundhati
>
>---
>
>Improve your web design skills with these new books from Glasshaus.
>
>Usable Web Menus
>http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
>r-20
>Constructing Accessible Web Sites
>http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
>r-20
>Practical JavaScript for the Usable Web
>http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
>r-20




_________________________________________________________________
Join the world?s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


  Return to Index