[thelist] Getting <button> to send value

James Aylard evolt at pixelwright.com
Thu Sep 26 12:50:01 CDT 2002


Craig,

> Why does <button> send the value as what's between the tag rather than
sending
> what's specified in value="" ?

    Because, unfortunately, IE's implementation of the button element is
broken. Technically, the HTML 4.x recommendation [1] doesn't specify that
the button element cannot submit its innerText value as the value of the
control, but this seems counterintuitive and, well, silly. I experimented
with workarounds, but found none that were satisfactory for my particular
situation [2].
    Ironically, Microsoft's MSDN documentation for the button element used
to state that the form would submit the value of the button to the server
unless it had no value, in which case it would submit the element's
innerText. However, the button element never worked that way in IE, and
instead of fixing the behavior Microsoft merely changed the wording of its
documentation [3]. Very disappointing, IMO.

1. http://www.w3.org/TR/html4/interact/forms.html#edef-BUTTON
2. http://lists.evolt.org/archive/Week-of-Mon-20001002/017911.html,
   http://lists.evolt.org/archive/Week-of-Mon-20001002/017917.html
3.
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/button.asp

James Aylard




More information about the thelist mailing list