W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2005

[whatwg] default action/button for forms

From: Michael Gratton <michael@quuxo.com>
Date: Fri, 11 Feb 2005 14:04:26 +1030
Message-ID: <1108092866.4753.40.camel@wintermute>
Hi guys,

After looking through the archives, surprised to find that there has
been no mention of some way to specify the default button/action for a
form.

Most browsers behave as the Web Forms 2.0 spec specifies in section 2.3,
"Changes to existing controls". That is, the first button is used as the
default. But this is pretty annoying behaviour. In a large form, it is
common to have several submit buttons and is is just as likely as it is
not that the first button should be the default.

As a result, web application developers generally resort to one of two
kluges: adding a hidden submit button to the form or using JavaScript to
trap key events or the form submission event.

For me is is also a problem because <troll>like today's common usable
desktop environments (Mac OS, GNOME, etc),</troll> I design forms so
that the default button is to the right of any additional action
buttons.

It would be great to see some way of specifying the default button for
the form in Web Forms 2.0, or some later revision. One way of
implementing this (and the way I would do it if I was fixing the problem
using JavaScript) would be to add a "default-action" attribute or
similar to the form element. This would be an IDREF that specifies the
id of the default submit button. Eg:

  <form action="bofh" method="post" default-action="lart">
    <input type="text" name="who">
    <input type="submit" id="ignore" name="action" value="Ignore">
    <input type="submit" id="lart" name="action" value="LART">
  </form>

What do you think?

/Mike

-- 
Michael Gratton, Software Architect.
Quuxo Software <http://web.quuxo.com/>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20050211/295fe386/attachment.pgp>
Received on Thursday, 10 February 2005 19:34:26 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:21 UTC