Re: button with forms

On Sun, Apr 25, 2010 at 9:03 AM, Roger Hudson <rhudson@usability.com.au> wrote:
> I understand that the use of the button element could cause some
> IE problems in the past and I was wondering if anyone any knows of
> any issues that might be associated with using the button approach
> now.

"button" is a relatively new addition to HTML. Legacy user agents
like Netscape 4 do not support it at all (the text appears but is
not clickable).

As you mention "button" could "cause some IE problems in the past".
But those IE versions (IE7 and earlier) are still widely used, and
manifest significant bugs in their implementation of "button":

   * The default value of "type" is "button" not "submit".
   * The "innerText" property is submitted as the control value rather than
     the "value" property.
   * All buttons are submitted when submitting a form, not just the
     button actually activated by the user (IE6 and earlier).

See:

   * http://msdn.microsoft.com/en-us/library/ms535211(VS.85).aspx
   * http://allinthehead.com/retro/330/coping-with-internet-explorers-mishandling-of-buttons
   * http://www.peterbe.com/plog/button-tag-in-IE

Whether these are problems "now" depends on your browser support
policy.

If you are only supporting recent browser releases, then I know of
no special problems with "button" beyond those typical of styling
form controls:

   * http://meyerweb.com/eric/thoughts/2007/05/15/formal-weirdness/
   * http://www.456bereastreet.com/lab/styling-form-controls-revisited/button/
   * http://particletree.com/features/rediscovering-the-button-element/

But if (like most web publishers) you continue to support IE7 and
earlier, I would generally suggest using "input" where possible, and
dynamically replacing "input" with "button" when "button" offers
advantages and you can repair these bugs with JS.

--
Benjamin Hawkes-Lewis

Received on Sunday, 25 April 2010 12:37:04 UTC