Skip to main content

Bug Tracker

Side navigation

#12575 closed bug (duplicate)

Opened September 19, 2012 11:31PM UTC

Closed September 19, 2012 11:56PM UTC

native form submit event doesn't trigger $.submit event

Reported by: after.fallout@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.0
Keywords: Cc:
Blocked by: Blocking:
Description

I am not sure if this is a bug in the documentation or in Core, but I cannot find anything that suggests this is by design.

jsfiddle: http://jsfiddle.net/8KNc7/5/

basically:

document.getElementById('theform').submit();

doesn't trigger

$('theform').submit();

See:

http://forum.jquery.com/topic/why-doesn-t-submitting-a-form-via-the-submit-method-on-the-form-element-invoke-submit-handlers

If this is on purpose, why doesn't http://api.jquery.com/submit/ say anything that suggests this is true?

Attachments (0)
Change History (3)

Changed September 19, 2012 11:35PM UTC by rwaldron comment:1

_comment0: Why would it? Those are two different APIs... \ \ There is no documentation because we expect that users at least understand that if your using jQuery, then you use jQuery. Right?1348098582800294
resolution: → notabug
status: newclosed

Why would it? Those are two different APIs...

There is no documentation because we expect that users at least understand that if you're using jQuery, then you use jQuery. Right?

Changed September 19, 2012 11:55PM UTC by dmethvin comment:2

resolution: notabug
status: closedreopened

Changed September 19, 2012 11:56PM UTC by dmethvin comment:3

resolution: → duplicate
status: reopenedclosed

Duplicate of #3115.Just for bookeeping, this is a dup.

We can't fire jQuery events because the native DOM doesn't call its handlers when you call the DOM form.submit() method. That's the way it works. There is no event we receive that would allow us to run the attached handlers.

You can run the handlers without submitting again via .triggerHandler("submit") if you can find a place to put it.

It's not mentioned in the docs because if you use jQuery it works fine via either .trigger("submit") or the .submit() shorthand.

http://jsfiddle.net/dmethvin/4AVSv/

If you use the native DOM methods underneath us, we can't always control what they do. Not sure how many places we can put information like that.