[whatwg] default action/button for forms

Matthew Raymond mattraymond at earthlink.net
Sun Feb 13 04:14:18 PST 2005


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" 
checked>).

    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 
line:

| <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...



More information about the whatwg mailing list