Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Form with two buttons that submit to different pages

Reply
Thread Tools

Form with two buttons that submit to different pages

 
 
Kevin Audleman
Guest
Posts: n/a
 
      08-23-2007
Hi, is it possible to create a form that has two submit buttons, and
each one submits to a different page?

Thanks,
Kevin

 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      08-24-2007
Kevin Audleman wrote:
> Hi, is it possible to create a form that has two submit buttons, and
> each one submits to a different page?


Yes, but unwise.


PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f806at$ail$1$(E-Mail Removed)>
 
Reply With Quote
 
 
 
 
dhtmlkitchen@gmail.com
Guest
Posts: n/a
 
      08-26-2007
On Aug 23, 5:57 pm, Thomas 'PointedEars' Lahn <(E-Mail Removed)>
wrote:
> Kevin Audleman wrote:
> > Hi, is it possible to create a form that has two submit buttons, and
> > each one submits to a different page?

>
> Yes, but unwise.
>

A better approach is to check the button that was clicked on the
server. Then forward your request using internal forwarding
mechanism.

In Java, the way to do it is to use a RequestDispatcher. This can be
done in Spring and struts by configuring an XML file.

String method = request.getParameter("method");
if( method.equals("button2") )
{
// Forward to the other controller.
}

I'm sure other languages/server side frameworks have similar
functionality

Garrett

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
Two submit buttons within one <form> Mike P ASP General 2 08-14-2008 02:10 PM
submit form to different locations on Radio buttons toggle sam Javascript 1 05-26-2006 07:34 AM
Forms with multiple submit buttons vs 'form' objects with single 'submit' methods neil.fitzgerald@ic.ac.uk Python 4 04-14-2006 04:58 PM
how to add two submit buttons to a form in struts sree Java 2 04-28-2004 02:12 PM



Advertisments