[whatwg] default action/button for forms
Michael Gratton
michael at quuxo.com
Thu Feb 10 19:34:26 PST 2005
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-0001.pgp>
More information about the whatwg
mailing list