Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 11 years ago

#7444 closed bug (fixed)

Submitting form with "Enter" instead of button click on ie8 or ie7 triggers live submit event twice.

Reported by: paul@… Owned by: dmethvin
Priority: high Milestone: 1.7
Component: event Version: 1.4.3
Keywords: Cc:
Blocked by: Blocking:

Description

Run the following using ie8 and you will see the event triggered twice. Run it in any other browser and it is triggered only once.

http://jsfiddle.net/paulrpayne/e38mm/

Change History (13)

comment:1 Changed 13 years ago by jitter

IE 6 is also affected

comment:2 Changed 13 years ago by boushley

I can confirm that this is not the case for a normal submit handler and that it also persists in the GIT 0 version of jQuery.

comment:3 Changed 13 years ago by snover

Component: unfiledevent
Milestone: 1.51.4.5
Priority: undecidedhigh
Status: newopen

Not a regression.

comment:4 Changed 12 years ago by iliakan

That's because of a tricky IE behavior.

When a user submits by pressing enter and the form has more than one text/password input field *and* there is a visible image/submit then IE generates onclick on the submit.

Hence, the special.submit catches both click and keypress.

The patch skips keydown if it knows that IE will throw click. Fixes the issue in IE 6,7,8.

https://github.com/jquery/jquery/pull/134

Last edited 12 years ago by iliakan (previous) (diff)

comment:5 Changed 12 years ago by iliakan

Last edited 12 years ago by iliakan (previous) (diff)

comment:6 Changed 12 years ago by snover

related to #6667?

comment:7 Changed 12 years ago by iliakan

Don't think it is related. Also, #6667 appears to be fixed in 1.4.4, while #7444 is not fixed.

P.S. And yeah I know that's crazy.

comment:8 Changed 12 years ago by xprommer

I have experienced the same problems. This happens because the browser (not only IE, i have tested IE 6-8, Firefox 3.6.8, Opera 11.01, Chrome 10, Safari 5.0.4), when user press key "Enter" in text/password input field, then the browser after keydown/keypress/keyup events send "click" event to the first submit/image button. That's why handler is called twice.

Last edited 12 years ago by xprommer (previous) (diff)

comment:9 Changed 12 years ago by anonymous

If there are any alternatives for bypassing this problem?

comment:10 Changed 12 years ago by paulrpayne

Is this ever going to be fixed on new releases, or are you waiting for ie to die? My workaround no longer works with the latest jQuery.

comment:11 Changed 12 years ago by rrafal@…

I run into the same bug. I'm using the latest version of jQuery (1.6.4) and testing with IE7 and IE8. iliakan's description of the problem is what I see too.

Please help!

comment:12 Changed 12 years ago by dmethvin

Milestone: 1.next1.7
Owner: set to dmethvin
Status: openassigned

comment:13 Changed 12 years ago by dmethvin

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.