W3C home > Mailing lists > Public > www-dom@w3.org > January to March 2012

DOM Level 2 HTML: Note about onsubmit is misplaced in HTMLFormElement spec (in enctype attribute rather than in submit method) (was Re: Minor formatting error in HTMLFormElement spec)

From: Filipus Klutiero <chealer@gmail.com>
Date: Sat, 21 Jan 2012 17:14:19 -0500
Message-ID: <4F1B38BB.6080105@gmail.com>
To: www-dom@w3.org
Dean Brettle wrote:

> In the spec for HTMLFormElement:
> http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-40002357
> The following text should probably appear under the submit method
> instead of the enctype attribute:
> <quote>
> Note: The onsubmit even handler is not guaranteed to be triggered when
> invoking this method. The behavior is inconsistent for historical
> reasons and authors should not rely on a particular one.
> </quote>
> Also, "even" should be "event".
> --Dean

I agree. I think fixing this would be quite important. The behavior of 
.submit() is causing lots of confusion. See for example:

By the way, the description of the submit method reads:
> submit
>     Submits the form. It performs the same action as a submit button.

I don't think the last sentence is correct. Using a submit input will 
trigger onsubmit. The submit method will not. Demonstration:

> <!DOCTYPE html>
> <html>
> <head>
> <title>submit behavior demonstration</title>
> </head>
> <body>
> <form id="target" action="destination.html" onsubmit="alert('Handler 
> for .submit() called.')">
> <input type="text" value="Hello there" />
> <input type="submit" value="Go" />
> </form>
> <div onclick="document.getElementById('target').submit()">
>           Call the DOM submit method
> </div>
> </body>
> </html>
Received on Saturday, 21 January 2012 22:14:51 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:37:00 UTC