Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Multiple submit buttons

Reply
Thread Tools

Multiple submit buttons

 
 
Nik Coughin
Guest
Posts: n/a
 
      10-20-2004
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/
-=-=-=-=-=-=-=-=-=-=-=-


 
Reply With Quote
 
 
 
 
brucie
Guest
Posts: n/a
 
      10-20-2004
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
 
Reply With Quote
 
 
 
 
Nik Coughin
Guest
Posts: n/a
 
      10-20-2004
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.



 
Reply With Quote
 
brucie
Guest
Posts: n/a
 
      10-20-2004
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
 
Reply With Quote
 
Toby Inkster
Guest
Posts: n/a
 
      10-20-2004
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

 
Reply With Quote
 
Jukka K. Korpela
Guest
Posts: n/a
 
      10-20-2004
Toby Inkster <(E-Mail Removed)> 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


 
Reply With Quote
 
Nik Coughin
Guest
Posts: n/a
 
      10-20-2004
Jukka K. Korpela wrote:
> Toby Inkster <(E-Mail Removed)> 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.


 
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
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
Re: Multiple submit buttons on one page Steve C. Orr [MVP, MCSD] ASP .Net 1 03-07-2005 08:25 PM
Multiple Submit Buttons Lau Lei Cheong ASP .Net 5 06-23-2004 06:38 AM
Multiple asp:buttons on one form but ONLY one should submit? D. Shane Fowlkes ASP .Net 3 02-24-2004 12:17 PM
Multiple forms and Multiple submit buttons and validation sandyde2 Javascript 2 10-02-2003 09:25 AM



Advertisments