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

[whatwg] default action/button for forms

From: Matthew Raymond <mattraymond@earthlink.net>
Date: Sun, 13 Feb 2005 07:14:18 -0500
Message-ID: <420F449A.1080903@earthlink.net>
Michael Gratton wrote:
> On Fri, 2005-02-11 at 11:52 -0500, Matthew Raymond wrote:
>>    I'd prefer something like this:
>>| <form action="http://somesite.com/prog/adduser" method="post">
>>|   <input type="text" name="who">
>>|   <input type="submit" name="action" value="Remove">
>>|   <input default type="submit" name="action" value="Add">
>>| </form>
> Sounds reasonable, it does allow some ambiguity however (what happens if
> there a multiple defaults in one form?)

    I just assumed we'd handle it the same way as |autofocus|:

| Authors should avoid setting the autofocus attribute on multiple
| enabled elements in a document. If multiple elements with the
| autofocus attribute set are  inserted into a document, each one will
| be processed as described above, as they are inserted. This means that
| during document load, for example, the last focusable form control in
| document order with the attribute set will end up with the focus.

    So the last button of the form set as the default would be default.

 > and the default button to my
> mind seems more like a property of the form then a control.

    I disagree. In Visual Basic, for instance, the value is set on the 
button, not the form. (Although, in VB, the environment automatically 
sets the value of the |default| property on all other buttons to false. 
I suppose HTML editors could follow suit.) Furthermore, HTML has a 
history of putting mutually exclusive values on items rather than the 
container of the items (see <option selected> and <input type="radio" 

    Also, in WA1, the <command> element has an attribute of the same 
name that does roughly the same thing.

> But hey, I'd be happy with either.

    Good to know. :)

Henri Sivonen wrote:
 > On Feb 11, 2005, at 18:52, Matthew Raymond wrote:
 >>| <input default type="submit" name="action" value="Add">
 > As a practical matter, it would be better to avoid new minimized
 > attributes in order to avoid changes to tag soup processors that
 > handle a closed list of attributes as special minimized cases.

    Yeah, WA1 does the same thing with <command>, so we can just fall in 

| <input default="default" type="submit" name="action" value="Add">

    Hmm. On a side note: What was our motivation for making people put 
the name of the property as the value in these cases? Why not just 
"true"? Not that important, though...
Received on Sunday, 13 February 2005 04:14:18 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:39 UTC