By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,092 Members | 1,650 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,092 IT Pros & Developers. It's quick & easy.

Q: possible Bug in IE 6 post more than succesfull control when using button tag

P: n/a
Short version: IE 6.0 wrongly posts <button ..> value. Internet
Explorer should only post the value of the clicked submit button - but
IE 6 posts the value of several submit buttons if they have the same
name

Long version:

I have a form with several Buttons with the same name and different
values. According to the w3c only successful controls supposed to be
submitted:

"A successful control is "valid" for submission. Every successful
control has its control name paired with its current value as part of
the submitted form data set. A successful control must be defined
within a FORM element and must have a control name. ..."

And

"If a form contains more than one submit button, only the activated
submit button is successful."

see at http://www.w3.org/TR/html401/interac...ssful-controls
So they speak of "submit button". The tag "<input type='submit'
name='myButt' ...>" supposed to be the same as "<button type='submit'
name="myButt' ..>foo</button>" accept for richer layout:
So i assume that only the clicked <button> supposed to be posted. Well
mozilla 1.7 does it right. IE 6 makes it wrong.

It is getting really annoying with this old (2001 ?!) Internet
Explorer 6.0

Here is an exmaple:
-------------------------------------------------------------------

<FORM action="" method="post">

<button type="submit" name="IEmyButt"
value="A is firstButton">A</button>

<button type="submit" name="IEmyButt"
value="B is secondButton">B</button>
</FORM>

-------------------------------------------------------------------
PHP show post values
<?
//php
echo "<span style='color:red'>Post<pre>"; print_r($_POST); echo
"</pre></span>";
?>

-------------------------------------------------------------------
Thanks.

Best Regards
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"Tom Asken" <as*****@gmx.net> wrote in message
news:8a**************************@posting.google.c om...
Short version: IE 6.0 wrongly posts <button ..> value. Internet
Explorer should only post the value of the clicked submit button - but
IE 6 posts the value of several submit buttons if they have the same
name

Long version:

I have a form with several Buttons with the same name and different
values. According to the w3c only successful controls supposed to be
submitted:


<snip>

Make sure you dont have overlapping form elements?
Jul 20 '05 #2

P: n/a
Gazing into my crystal ball I observed as*****@gmx.net (Tom Asken) writing
in news:8a**************************@posting.google.c om:
Short version: IE 6.0 wrongly posts <button ..> value. Internet
Explorer should only post the value of the clicked submit button - but
IE 6 posts the value of several submit buttons if they have the same
name


Confirmed - http://www.intraproducts.com/beta/buttons.asp
--
Adrienne Boswell
Please respond to the group so others can share
http://www.arbpen.com
Jul 20 '05 #3

P: n/a
"Tom Asken" <as*****@gmx.net> schrieb im Newsbeitrag
news:8a**************************@posting.google.c om...

[...]
Here is an exmaple:
-------------------------------------------------------------------

<FORM action="" method="post">

<button type="submit" name="IEmyButt"
value="A is firstButton">A</button>

<button type="submit" name="IEmyButt"
value="B is secondButton">B</button>
</FORM>

-------------------------------------------------------------------
PHP show post values
<?
//php
echo "<span style='color:red'>Post<pre>"; print_r($_POST); echo
"</pre></span>";
?>


If you use PHP you can easily work around this using different button names:

<?php
if(isset($_POST['button1'])) $value = $_POST['button1'];
else if(isset($_POST['button2'])) $value = $_POST['button2'];
else $value = "my custom value";
?>

Like that you also have no problem when no button is clicked at all and the
form is submitted by hitting enter.

HTH
Markus
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.