[whatwg] HTMLForms: Implicit Submission with {display:none} button

Ian Hickson ian at hixie.ch
Fri Jun 29 16:25:54 PDT 2012

On Fri, 29 Jun 2012, Boris Zbarsky wrote:
> On 6/29/12 6:19 PM, Boris Zbarsky wrote:
> > In any case, I believe the spec is wrong in one aspect: in the case 
> > that there is a default button, what needs to happen is a click event 
> > on that button, not just a triggering of its activation behavior. In 
> > particular, onclick handlers need to fire and the activation behavior 
> > should only happen if preventDefault is not called on the event.
> Note that depending on how <input disabled> defines handling of click 
> events, we may get the right thing happening with it for free. 
> Unfortunately, I'm failing to find where the spec talks about the actual 
> behavior of @disabled on submit controls.  :(

It's a bit of a tortuous route.

The definition of <input> says:

# The disabled attribute is used to make the control non-interactive and 
# to prevent its value from being submitted.
 - http://www.whatwg.org/specs/web-apps/current-work/#the-input-element

...which links to:

# A form control is disabled if its disabled attribute is set [...]
 - http://www.whatwg.org/specs/web-apps/current-work/#attr-fe-disabled

This is used in the <input> element section:

# When an input element is disabled, it is immutable.
 - http://www.whatwg.org/specs/web-apps/current-work/#concept-input-immutable

This is then used in the type=submit definition:

# If the element is immutable, it has no activation behavior.
 - http://www.whatwg.org/specs/web-apps/current-work/#submit-button-state-(type=submit)

And now the implicit submission section says:

# If the platform supports letting the user submit a form implicitly (for 
# example, on some platforms hitting the "enter" key while a text field is 
# focused implicitly submits the form), then doing so for a form whose 
# default button has a defined activation behavior must cause the user 
# agent to run synthetic click activation steps on that default button.
# Consequently, if the default button is disabled, the form is not 
# submitted when such an implicit submission mechanism is used. (A button 
# has no activation behavior when disabled.)
 - http://www.whatwg.org/specs/web-apps/current-work/#implicit-submission

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