Multiple submit buttons

Discussion in 'HTML' started by Nik Coughin, Oct 20, 2004.

  1. Nik Coughin

    Nik Coughin Guest

    With multiple submit buttons in IE, how do I tell which button has been
    pressed?

    If I do this in IE:

    <form action="index.html">
    <p>
    <button name="move" value="up" type="submit">up</button>
    <button name="move" value="down" type="submit">down</button>
    </p>
    </form>

    I get:

    index.html?move=up&move=down

    I thought that if you had two submit buttons with the same name, it only
    posted the name\value of the one that was clicked? I can't tell which one
    it was from that.

    It works in Opera. If I click the up button I get:

    index.html?move=up

    Does IE really not support multiple submit buttons, or have I overlooked
    something?

    --
    "Come to think of it, there are already a million monkeys on a million
    typewriters, and the Usenet is NOTHING like Shakespeare!" - Blair Houghton
    -=-=-=-=-=-=-=-=-=-=-=-
    http://www.nrkn.com/
    -=-=-=-=-=-=-=-=-=-=-=-
    Nik Coughin, Oct 20, 2004
    #1
    1. Advertising

  2. Nik Coughin

    brucie Guest

    In alt.html Nik Coughin said:

    > With multiple submit buttons in IE, how do I tell which button has been
    > pressed?
    >
    > <button name="move" value="up" type="submit">up</button>
    > <button name="move" value="down" type="submit">down</button>


    use different names

    --


    v o i c e s
    brucie, Oct 20, 2004
    #2
    1. Advertising

  3. Nik Coughin

    Nik Coughin Guest

    brucie wrote:
    > In alt.html Nik Coughin said:
    >
    >> With multiple submit buttons in IE, how do I tell which button has
    >> been pressed?
    >>
    >> <button name="move" value="up" type="submit">up</button>
    >> <button name="move" value="down" type="submit">down</button>

    >
    > use different names


    Hi brucie.

    If I use different names:

    <form action="index.html">
    <p>
    <button name="moveUp" value="up" type="submit">up</button>
    <button name="moveDown" value="down" type="submit">down</button>
    </p>
    </form>

    I get:

    index.html?moveUp=up&moveDown=down

    ....and I still can't tell which button was pressed. This is only with IE.

    At the moment I am using this instead, as it works in IE:

    <input name="move" value="down" type="submit">
    <input name="move" value="up" type="submit">

    By doing that, if I click up I get:

    index.html?move=up

    I have a feeling IE is broken in regards to using a button element in this
    way. Guess I'll have to stick to input, which is annoying as it uses the
    value as both value and caption.
    Nik Coughin, Oct 20, 2004
    #3
  4. Nik Coughin

    brucie Guest

    In alt.html Nik Coughin said:

    > If I use different names:
    > <button name="moveUp" value="up" type="submit">up</button>
    > <button name="moveDown" value="down" type="submit">down</button>
    > I get:
    >
    > index.html?moveUp=up&moveDown=down


    use <input> elements

    > I have a feeling IE is broken


    go with that feeling

    --


    v o i c e s
    brucie, Oct 20, 2004
    #4
  5. Nik Coughin

    Toby Inkster Guest

    Nik Coughin wrote:

    > <form action="index.html">
    > <p>
    > <button name="move" value="up" type="submit">up</button>
    > <button name="move" value="down" type="submit">down</button>
    > </p>
    > </form>


    IE's handling of <button> is broken. Use <input type="submit"> instead.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, Oct 20, 2004
    #5
  6. Toby Inkster <> wrote:

    > Nik Coughin wrote:
    >
    >> <form action="index.html"> <p>
    >> <button name="move" value="up" type="submit">up</button>
    >> <button name="move" value="down" type="submit">down</button> </p>
    >> </form>

    >
    > IE's handling of <button> is broken. Use <input type="submit"> instead.


    However, you still have a problem if the actual form contains text input
    fields. Then browsers may behave as if a submit button had been clicked
    on, if the user hits Enter in a text field, and you might not know which
    button will be "simulated".

    On the other hand, with the specific form above, there's the simple
    option of using two links instead of any form or buttons.

    --
    Yucca, http://www.cs.tut.fi/~jkorpela/
    Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html
    Jukka K. Korpela, Oct 20, 2004
    #6
  7. Nik Coughin

    Nik Coughin Guest

    Jukka K. Korpela wrote:
    > Toby Inkster <> wrote:
    >
    >> Nik Coughin wrote:
    >>
    >>> <form action="index.html"> <p>
    >>> <button name="move" value="up" type="submit">up</button>
    >>> <button name="move" value="down" type="submit">down</button>
    >>> </p> </form>

    >>
    >> IE's handling of <button> is broken. Use <input type="submit">
    >> instead.

    >
    > However, you still have a problem if the actual form contains text
    > input fields. Then browsers may behave as if a submit button had been
    > clicked on, if the user hits Enter in a text field, and you might not
    > know which button will be "simulated".
    >
    > On the other hand, with the specific form above, there's the simple
    > option of using two links instead of any form or buttons.


    That was just to illustrate the problem, but sounds like a good idea. Links
    are cleaner and take up less space anyway.
    Nik Coughin, Oct 20, 2004
    #7
    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:
    614
    S. Justin Gengo
    Feb 24, 2004
  2. Lau Lei Cheong

    Multiple Submit Buttons

    Lau Lei Cheong, Jun 21, 2004, in forum: ASP .Net
    Replies:
    5
    Views:
    2,888
    Lau Lei Cheong
    Jun 23, 2004
  3. Steve C. Orr [MVP, MCSD]

    Re: Multiple submit buttons on one page

    Steve C. Orr [MVP, MCSD], Mar 7, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    445
    Jeffrey Palermo
    Mar 7, 2005
  4. Replies:
    4
    Views:
    884
  5. sandyde2
    Replies:
    2
    Views:
    172
    sandyde2
    Oct 2, 2003
Loading...

Share This Page