submit() skips onsubmit event

RESOLVED DUPLICATE of bug 45190

Status

()

Core
DOM: Core & HTML
RESOLVED DUPLICATE of bug 45190
14 years ago
12 years ago

People

(Reporter: Nicolás Ernesto Kuzminski, Assigned: Blake Ross)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040206 Firefox/0.8

Use of form.submit() method, causes event onsubmit to be not fired. Clicking a
submit button does work as expected.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.

Updated

14 years ago
Summary: submit() skips onsubmit event → submit() skips onsubmit event
Whiteboard: DUPEME - bug 242494?

Comment 1

14 years ago
Reporter, can you please attach a testcase or an URL that demonstrate the problem?

I doubt this is a dupe of bug 242494, since that is a recent regression and the
reporter is using 0.8.
Whiteboard: DUPEME - bug 242494?

Comment 2

14 years ago
Created attachment 148772 [details]
form.submit() failure when button disabled too testcase

Same bug or new? when using an onClick to submit a form AND disable the form
submit button, the form.submit() is ignored. testcase attached.

Comment 3

14 years ago
(In reply to comment #2)
> Created an attachment (id=148772)
> form.submit() failure when button disabled too testcase
> 

Testcase WFM. That was bug 242494 which is fixed in the 20040518 build. 

(Reporter)

Comment 4

14 years ago
Created attachment 148910 [details]
seeing if submit() method triggers onsubmit event

This attach show exactly the problem I found out.

Comment 5

14 years ago
(In reply to comment #4)
> Created an attachment (id=148910)
> seeing if submit() method triggers onsubmit event
> 
> This attach show exactly the problem I found out.

This testcase also worksforme, can you please retry with a fresh profile and
report back here?

(Reporter)

Comment 6

14 years ago
> This testcase also worksforme, can you please retry with a fresh profile and
> report back here?

Now with FireFox 0.9, the problem persists.

Comment 7

14 years ago
Please answer the following questions

1. Did you uninstall 0.8 before installing 0.9? 
2. Did you try this with a new profile?

Comment 8

14 years ago
http://bugzilla.mozilla.org/attachment.cgi?id=148910&action=view
is also a problem with Mozilla 1.x 20040803

and also a problem in Firefox 20040804 Firefox/0.9.1+
Status: UNCONFIRMED → NEW
Ever confirmed: true
I can see the bug too (no alert where I should see one).
It might be interesting to know that 4 years ago, there was a similar bug: bug
45190.
This had even a patch, but it was marked invalid, because the spec was not clear
(in their opinion) and IE also doesn't trigger an onsubmit event. 
I don't think the spec is unclear, see:
http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.3
"onsubmit = script [CT]
    The onsubmit event occurs when a form is submitted. It only applies to the
FORM element."
So a document.forms[0].submit() should trigger an onsubmit event.
Component: General → DOM: Level 0
Product: Firefox → Browser
Version: unspecified → Trunk
Hmm, but I get the feeling there are a lot of scripts/websites who rely on it
not to be fired. 
If this would be fixed in Mozilla, I think it could cause quite some problems.
The current behavior is the one we want.

*** This bug has been marked as a duplicate of 45190 ***
Status: NEW → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → DUPLICATE

Comment 12

12 years ago
Kinda off topic but nevertheless:
Just suffered from this one, too, and I wonder why this behaviour is the wanted one?
When did mozilla change their policy to enforce developing against the specs, against clean code and instead made up their mind for code that doesn't work although it obviously should?
Making mistakes because of IE preceded doing so won't pay off I guess. The more so as firefox becomes the browser reference for developers.

Are there any guidelines covering this unexpected attitude so I could try beginning to understand?
pong, see 45190, comment 4.
Changing this could potentially break a lot of websites.
> When did mozilla change their policy to enforce developing against the specs

What gave you the idea that this was a firm policy?  It hasn't.  It's been a guideline.

> Are there any guidelines covering this unexpected attitude so I could try
> beginning to understand?

If the spec in question (DOM2 Events) has a wide divergence with reality in the DOM0 stuff it tried to standardize (as in this case) such that implementing the spec would break pretty much all consumers of the functionality in question, that's a good time to stop and think, basically.

Comment 15

12 years ago
Yeah I already read the reasons why this bug won't be fixed although almost anyone out there agrees it basically should - at least as a matter of principle.
I just think it's way too chicken-hearted not to. A wrong decision can't become the right one by imitation.
Do you think MS will make their SSL-background yellow because of mozilla did? I wouldn't bet my life on this.
Would mozilla instead adapt their color to the (maybe right or more intuitive) MS-one? I cant say but chances are way better.
I thought that this kind of standardizing has been overcome as of today..
Way too pathetic to cite apples think different campaign so i won't

Nevertheless I still propagate: better make a decisive and countable number of websites not working for a while than make it harder than necessary for countless future projects and developers.

But I'll give up on fighting for this world right now :)

Regards, pong
It's not 'chicken-hearted' or 'pathetic', it's common sense.
It's really annoying when you've filled in a form in a website and it won't submit. It happened to me sometimes in Mozilla, what do you think will happen when the average user gets these problems? They'll blame the browser (because it was working in IE).

Comment 17

12 years ago
although i swore not to reply further i will add two last comments.

i don't fully agree on the <they'll blame the browser>-part. many may do so but nowadays most of them are enlightened enough to blame IE instead - at least for introducing bad habits and behaviour. Firefox is pretty sure known as the far better browser by the vast majority of surfers - so why not make use of this advantage and set the standards - respectively put them through..

there are soooo many differences between IE and firefox where firefox knowingly didnt follow IEs meander but asserted the specs - which caused almost every website not to render as intended by the devels, not regarding different JS behaviour ... . so why does mozilla break its own attitude here, why do they turn back halfway done? that's what doesnt fit my brain..

thirdly - for the sake of completeness - i guess a misunderstanding has taken place regarding "developing AGAINST the specs"


now i feel like i've said everything from my side, pretty relieving (:

maybe others will come and strengthen my position, maybe not, maybe irrelevant..

have a nice day altogether!
You need to log in before you can comment on or make changes to this bug.