Bug Tracker

Ticket #7444 (closed bug: fixed)

Opened 4 years ago

Last modified 2 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 4 years ago by jitter

IE 6 is also affected

comment:2 Changed 4 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 4 years ago by snover

  • Priority changed from undecided to high
  • Status changed from new to open
  • Component changed from unfiled to event
  • Milestone changed from 1.5 to 1.4.5

Not a regression.

comment:4 Changed 4 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 4 years ago by iliakan (previous) (diff)

comment:5 Changed 4 years ago by iliakan

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

comment:6 Changed 4 years ago by snover

related to #6667?

comment:7 Changed 3 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 3 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 3 years ago by xprommer (previous) (diff)

comment:9 Changed 3 years ago by anonymous

If there are any alternatives for bypassing this problem?

comment:10 Changed 3 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 3 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 3 years ago by dmethvin

  • Owner set to dmethvin
  • Status changed from open to assigned
  • Milestone changed from 1.next to 1.7

comment:13 Changed 3 years ago by dmethvin

  • Status changed from assigned to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.