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

Ryosuke Niwa ryosuke.niwa at gmail.com
Sun Sep 25 14:35:16 PDT 2011


On Sep 25, 2011 11:48 AM, "Boris Zbarsky" <bzbarsky at mit.edu> wrote:
> On 9/24/11 4:45 PM, Ryosuke Niwa wrote:
>> 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.

This is a good point. So Gecko fires a click event on a button even if it
had display: none or visibiliy: hidden?

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

Right, determining whether there is excatly one text field is tricky.

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

Thanks for the pointer!  This is very helpful.

- Ryosuke



More information about the whatwg mailing list