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

Re: HTMLFormElement submit Method

From: John Keiser <jkeiser@iname.com>
Date: 11 Feb 2002 02:57:11 -0700
To: Steven Elliott <elliott@mail.cibertribe.pt>
Cc: WWW DOM <www-dom@w3.org>, Philippe Le Hegaret <plh@w3.org>
Message-Id: <1013421437.2099.253.camel@cy209696-a>
On Mon, 2002-02-11 at 13:14, Steven Elliott wrote:
> On 11/02/02 19:22, "Philippe Le Hegaret" <plh@w3.org> wrote:
> 
> > On Tue, 2001-12-11 at 14:04, Steven Elliott wrote:
> >> Microsoft (MSDN site) claims that the submit method of a form does not
> >> invoke the onsubmit event handler.
> >> 
> >> Microsoft goes on to claim on the same page that this method (submit method)
> >> is defined in the W3C DOM Level 1.
> >> 
> >> The reference I find for the HTMLFormElement in the DOM is section 2.5.5.
> >> Object Definitions.  Here it defines the submit method as performing the
> >> same action as a submit button which implies invoking the onsubmit event.
> >> 
> >> I cannot find any specific reference here for whether or not the onsubmit
> >> event should or should not be included.
> >> 
> >> Can you clarify this please because I believe not calling an onsubmit method
> >> if one is defined for a form would be a violation of the W3C L1 DOM?
> > 
> > Unfortunately, given the differences between implementations, it was not
> > possible to find a common ground on this issue. No changes were in the
> > specification. You cannot rely on having an event when invoking the
> > submit() method.
> > 
> > Please, let us know if you are (or are not) satisfy with this decision,
> > 
> > Philippe,
> > for the DOM WG.
> > 
> > 
> I am not sure to what you are referring to as *differences between
> implementations*.  In any case I am not satisfied.
> 
> Any means which permits the client to circumvent conditions placed upon the
> form submit method invalidates the purpose of having an onsubmit method
> (particullarly in light of the fact that it is used in 99% of cases as a
> validation tool). To my mind this is (permits) a grave abuse of an implied
> contract and the onsubmit method should be removed from the FORM object.  At
> the very least it should be boldly stated in any and all documentation that
> the onsubmit event IS NOT GUARANTEED to be called by the submit method.
> 

It should be defined to not fire onSubmit.  No JavaScript functions fire
events that I know of (at least in forms).  onChange doesn't happen when
you change .value or .checked.  It is not the user who is calling JS
.submit().  It is the page designer.  We presume that the designer knows
enough about his app that when he calls submit() without validating he's
*deliberately* circumventing his stuff for whatever reason.  This gives
the prog

IE, NS4.x, NS6.x, and Konqueror work this way.  What widely-used
implementations *do* fire onSubmit() that make it impossible to define
it this way in the DOM?

I am not satisfied either.  I think we should define this behavior the
way current implementations do it, as it has a strong effect on Web
application development.  No more if(browserType) !

--John Keiser
Received on Monday, 11 February 2002 17:27:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:55 GMT