473,388 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Using multiple button type="submit" elements within a form

Hey guys,

I've decided to stop banging my head against the wall and just ask you
guys for the answer. I can't seem to find it.

I have a form in which I have multiple submit buttons; only, I'm using
button tags, not input tags to do it. It seems that IE6 is treating
all the button elements as being successful on submit. This is, to say
the least, surprising since the Spec is pretty clear that it should.

To test this, i created the following trivial HTML page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Trivial Form Submit Test</title>
</head>

<body>
<form action="#" method="get">
<label>Field 1 <input name="field1" /></label><br />
<label>Field 2 <input name="field2" /></label><br />
<label>Field 3 <input name="field3" /></label><br />
<button name="Button1" type="submit" value="button 1">This is
button 1</button><br />
<button name="Button2" type="submit" value="button 2">This is
Button 2</button><br />
<button name="Multibutton" type="submit" value="Value 1">This
multibutton value 1</button><br />
<button name="Multibutton" type="submit" value="Value 2">This
multibutton value 2</button>
</form>
</body>
</html>

In IE I get the name/value pairs for all the buttons, as well as the
input vaules.

What fixes, if any, are there. I really don't want to use input
type="submit" or input type="image".

Thanks
Adam
Jul 24 '05 #1
3 10114
Let me add an addendum. IE seems also to submit the content of the tag,
not its value.

When I added:
<button name="Multibutton" type="submit" value="Value 3"><img
src="http://groups-beta.google.com/groups/img/groups_medium.gif"
/></button>

To my utter horror, the value that was sumbitted was the image tag URL
encoded.

does anyone else have similar experiences?

Jul 24 '05 #2
Adam wrote:
I have a form in which I have multiple submit buttons; only, I'm using
button tags, not input tags to do it. It seems that IE6 is treating
all the button elements as being successful on submit.
Yes, its a known bug in that excuse for a browser. You'd think they could
fix it with all the service packs that keep coming out for it.
What fixes, if any, are there. I really don't want to use input
type="submit" or input type="image".


That's about your only choice. You can use different names if you want to
reuse the same value - its more work to test on the server side, but about
the only way to deal with MSIE.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 24 '05 #3
David Dorward <do*****@yahoo.com> wrote:
What fixes, if any, are there. I really don't want to use input
type="submit" or input type="image".


That's about your only choice. You can use different names if you
want to reuse the same value - its more work to test on the server
side, but about the only way to deal with MSIE.


There would _still_ be the problem that there is no definition of what
should happen when the user hits Enter in a text input field.
And browsers vary in their interpretations.

The really safe way is to have one input type="submit" and handle the
rest with other fields (other than any kind of submit fields). Then the
browser differences won't matter. This should at least the the first
alternative to be considered. You can add e.g. a set of radio buttons
for choosing the action to be carried out by the form handler, rather
than using different submit buttons for such a choice.

If this is regarded as impossible, you probably need to expect that a
browser will behave as if the _first_ button were used, when the form
is submitted by hitting Enter in a text input field. And how would you
handle that? You won't know whether the use accidentally hit Enter or
really used the first input button. So you might end up with adding a
dummy first button for that purpose. Rather artificial.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Jul 24 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Phil Powell | last post by:
Has anyone here ever done a case where you have a select multiple form element and you have to do both server-side and client-side validation? I am honestly not sure how to do it in Javascript (I...
5
by: lsarg | last post by:
i've been trying forever to figure out a way to use a regular text link in place of a submit button at the bottom of this. can't get it. i'm just starting to learn php, so i'm stuck. any help at...
3
by: news | last post by:
I'm working with a CGI program that was using several standard buttons for input using <input type="submit" name="abuttonName" ... Now, I'm trying to replace the standard buttons with images...
3
by: Pete Wilson | last post by:
How can I highlight the <input type="submit"> object that I want to highlight? 1. In my form, the user enters his ID. He sees two submit "buttons," left labeled Cancel, the right labeled Signup....
5
by: Alex Maghen | last post by:
In ASPX 2.0 with MasterPages and all that, my entire page only has one actual <FORM>. But there are several different sections of the page that provide what are functionally separate forms with...
9
by: Alexandra | last post by:
Not sure why none of these permutations are working. I appreciate a second set of eyes! .... <form id="form1" name="form1" > .... <input name="Submit1" type="submit" tabindex="10"...
5
Vini171285
by: Vini171285 | last post by:
Hi, Here in this code we have used CInt before Session,If we wont use CInt the code doesn't work in the intended way....and using CInt sometimes gives error..It works for 1 day & the other day shows...
14
by: white lightning | last post by:
How to have <select onchange="this.form.submit()"and also a Submit button on one form? I have something like this: <form action="<?php $_SERVER; ?>" method="post"...
2
by: ChrisLA | last post by:
Hi; I've seen lots of discussion & disagreement on this issue, so any good explanation would be appreciated. Some people seem to think that "document.GetElementByID("MyName").submit(); should...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.