[whatwg] default action/button for forms

Ian Hickson ian at hixie.ch
Sun Mar 20 17:26:11 PST 2005


On Sun, 13 Feb 2005, Matthew Raymond wrote:
> > 
> > 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|:

The "autofocus" case is easy because it is just saying "when it is 
inserted, do something". The default button case is harder because it 
isn't doing anything until a lot later, when the form is rendered or 
someone invokes the default action.

Thus for autofocus, you can define it in terms of a DOM call that happens 
when the element is inserted, but for default, you need a way to be able 
to look up the default button easily.

Thus an attribute on the form is easier.

Having said that, I agree that an attribute on a button would be easier to 
author.


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

HTML also has a history of problems stemming from this design pattern (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.

With <command> it is easier since you process the menu at a fixed time 
without exposing the intermediate steps to the DOM, so you can define 
things like the error handling of multiple defaults (more) easily.


> | <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"? 

Because in SGML, you can omit the attribute name and just give the value, 
as in:

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

Not that anyone correctly supports that or anything.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list