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

Boris Zbarsky bzbarsky at MIT.EDU
Sun Sep 25 11:48:18 PDT 2011


On 9/24/11 4:45 PM, Ryosuke Niwa wrote:
> Basically, IE9 only does implicit submission when there is exactly one text
> field (you can have checkbox, hidden, etc...) or there is a visible button
> (i.e. not diplay: none nor visibility: hidden).
>
> Firefox 5 does implicit submission in the following conditions:
>
>     - One text field
>     - One text field with one visible submit button
>     - One text field with one display:none submit button
>     - Two text fields with one visible submit button
>     - Two text fields with one visibility:hidden submit button
>     - Two text fields with one display:none submit button
>
> It does not do implicit submissio in the following conditions:
>
>     - Two text fields

Not doing that last is actually a requirement for web compat, last I 
looked at this.

Furthermore, a requirement for web compat is that in the two-textfield 
case the submission happen via triggering a click event on the default 
submit element for the form and then allowing that to trigger submission 
as it would normally (or not trigger it, if the page prevents its 
default action, etc).  I expect this event-firing business is why IE has 
any sort of dependency on styles for the submit button, and I would not 
be surprised if that's why WebKit has it too.

For the one-text-input case, as I recall IE does NOT click the default 
submit, at least as of 2002; Gecko used to have that behavior but we 
opted for more consistency.  So the current Gecko behavior is to submit 
via clicking the default submit input if there is one, else to submit 
only if there is only one text control (where the definition of "text 
control" is especially interesting, since it of course includes controls 
of unknown types, so as new form control types are added things get 
_really_ exciting before browsers implement them).

Submitting forms with no submit on enter in a single text control is 
also required for web compat, of course.

There is also the separate issue of _which_ controls enter triggers 
submission in (e.g. it works in checkbox or radio in Gecko, iirc, but of 
course not in textarea).

For those who want to mess with the spec for this behavior, 
https://bugzilla.mozilla.org/show_bug.cgi?id=99920 and 
https://bugzilla.mozilla.org/show_bug.cgi?id=109463 and 
https://bugzilla.mozilla.org/show_bug.cgi?id=147850 are necessary (but 
probably not sufficient) reading.

Also necessary is a decent test matrix and testing in all 4 relevant 
engines, of course.

-Boris


More information about the whatwg mailing list