Form with two buttons that submit to different pages

Discussion in 'Javascript' started by Kevin Audleman, Aug 24, 2007.

  1. Hi, is it possible to create a form that has two submit buttons, and
    each one submits to a different page?

    Thanks,
    Kevin
     
    Kevin Audleman, Aug 24, 2007
    #1
    1. Advertising

  2. 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$>
     
    Thomas 'PointedEars' Lahn, Aug 24, 2007
    #2
    1. Advertising

  3. Kevin Audleman

    Guest

    On Aug 23, 5:57 pm, Thomas 'PointedEars' Lahn <>
    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
     
    , Aug 26, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sree
    Replies:
    2
    Views:
    3,807
    Tim Slattery
    Apr 28, 2004
  2. Replies:
    4
    Views:
    964
  3. Mike P

    Two submit buttons within one <form>

    Mike P, Aug 14, 2008, in forum: ASP General
    Replies:
    2
    Views:
    166
    Evertjan.
    Aug 14, 2008
  4. Martin Nadoll

    Form Focus with two Submit-Buttons

    Martin Nadoll, Jan 21, 2004, in forum: Javascript
    Replies:
    1
    Views:
    128
    DJ WIce
    Jan 21, 2004
  5. sam
    Replies:
    1
    Views:
    115
    Dag Sunde
    May 26, 2006
Loading...

Share This Page