one form two buttons again :-)

Discussion in 'HTML' started by sindre, Sep 27, 2004.

  1. sindre

    sindre Guest

    Hi,

    In quite a long time I have tought that this question have only one answer.
    It wont work. But then I tried it and it did work.
    So the question is do it always work? Is there a reason to not do this?
    Why I ask is if this work I can set php to figure out what to do with the
    input based on the submit name/value!

    What I tried is
    <input type="submit" name="save" value="Save">
    <input type="submit" name="save2" value="Save2">

    Both sends the form input.

    Sindre
     
    sindre, Sep 27, 2004
    #1
    1. Advertising

  2. sindre

    SpaceGirl Guest

    sindre wrote:
    > Hi,
    >
    > In quite a long time I have tought that this question have only one answer.
    > It wont work. But then I tried it and it did work.
    > So the question is do it always work? Is there a reason to not do this?
    > Why I ask is if this work I can set php to figure out what to do with the
    > input based on the submit name/value!
    >
    > What I tried is
    > <input type="submit" name="save" value="Save">
    > <input type="submit" name="save2" value="Save2">
    >
    > Both sends the form input.
    >
    > Sindre
    >
    >


    Rather than have the 2nd button submit your form, have it run a
    javascript that collects the values of the form elements and posts them
    for you to the alternate form processor. That way you can have as many
    submit buttons as you care for.


    --


    x theSpaceGirl (miranda)

    # lead designer @ http://www.dhnewmedia.com #
    # remove NO SPAM to email, or use form on website #
     
    SpaceGirl, Sep 27, 2004
    #2
    1. Advertising

  3. "sindre" <> wrote:

    > In quite a long time I have tought that this question have only one
    > answer.


    It's best to start from the question. What was it, really?

    > It wont work. But then I tried it and it did work.


    Sounds like a zen thing.

    > So the question is do it always work?


    Maybe, maybe not.

    > Is there a reason to not do this?


    Depends on "this" (and the current definition of "reason").

    > What I tried is
    > <input type="submit" name="save" value="Save">
    > <input type="submit" name="save2" value="Save2">
    >
    > Both sends the form input.


    Ummm... not surprisingly, right?

    If the question is whether you can reliably recognize which button was
    used, then it _is_ a frequently asked question. Do you want us to carry
    out the Nth iteration of the discussion, or would you like to peek at the
    FAQs? (Remember that on Usenet, the Nth iteration is usually an
    improvement over the (N+1)th iteration.)

    The short answer is that such a scenario, with adequate server-side code,
    works reliably in the special case where the form has no text input
    fields.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
     
    Jukka K. Korpela, Sep 27, 2004
    #3
  4. sindre

    sindre Guest

    > If the question is whether you can reliably recognize which button was
    > used, then it _is_ a frequently asked question. Do you want us to carry
    > out the Nth iteration of the discussion, or would you like to peek at the
    > FAQs? (Remember that on Usenet, the Nth iteration is usually an
    > improvement over the (N+1)th iteration.)
    >
    > The short answer is that such a scenario, with adequate server-side code,
    > works reliably in the special case where the form has no text input
    > fields.
    >


    It's fine. Thank you.
    I could take a look at the FAQ!
    Sindre
     
    sindre, Sep 27, 2004
    #4
  5. sindre

    Toby Inkster Guest

    SpaceGirl wrote:

    > Rather than have the 2nd button submit your form, have it run a
    > javascript that collects the values of the form elements and posts them
    > for you to the alternate form processor. That way you can have as many
    > submit buttons as you care for.


    You don't need javascript to have multiple submit buttons.
    http://examples.tobyinkster.co.uk/2-submit-buttons/

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Sep 27, 2004
    #5
    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. D. Shane Fowlkes
    Replies:
    3
    Views:
    631
    S. Justin Gengo
    Feb 24, 2004
  2. Roger
    Replies:
    1
    Views:
    639
    GreggTB
    May 20, 2005
  3. Replies:
    1
    Views:
    432
    Bruno Alexandre
    Oct 3, 2006
  4. Mike P

    Two submit buttons within one <form>

    Mike P, Aug 14, 2008, in forum: ASP General
    Replies:
    2
    Views:
    156
    Evertjan.
    Aug 14, 2008
  5. Poko

    one form two buttons(well three)

    Poko, Oct 23, 2005, in forum: Javascript
    Replies:
    2
    Views:
    110
    Evertjan.
    Oct 24, 2005
Loading...

Share This Page