Bug 25497 - onclick handler of submit button is not triggered when pressing enter key in input field
Summary: onclick handler of submit button is not triggered when pressing enter key in ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-30 16:32 PDT by Michael Du
Modified: 2012-10-22 12:13 PDT (History)
5 users (show)

See Also:


Attachments
Here is a simple case on the issue. (609 bytes, text/html)
2009-04-30 16:38 PDT, Michael Du
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Du 2009-04-30 16:32:02 PDT
Steps:

1. create a form with a submit button in it like this:
<button type="submit" onclick="alert('submit')"></button>
and with at least 2 input fields in it

2. Input some text in any of the input fields and then press enter key

Issue:

Form gets submitted, but the onclick is ignored (unlike in other browsers)

Other Browsers:

IE7: OK
FF3: OK

Nightly tested: 42793

Bug in Chromium : http://code.google.com/p/chromium/issues/detail?id=11113
Comment 1 Michael Du 2009-04-30 16:38:22 PDT
Created attachment 29928 [details]
Here is a simple case on the issue.

Here is a simple case on the issue.
Comment 2 Alexey Proskuryakov 2009-05-01 03:23:29 PDT
Confirmed with r43111.
Comment 3 Arvind 2009-06-03 22:37:23 PDT
Hi,

I tried fixing this bug by adding an extra condition in the submitclick() function of Htmlformelement.cpp.When comparing for the input tag I tried comaparing for the button tag also which makes the test case to pass.Can this solution be used to fix this bug ?
Comment 4 Michael C. 2009-11-26 13:43:40 PST
In both Safari 4.0.4 (531.21.10) for Windows and Google Chrome 3.0.195.33, this bug is a simple matter of capitalization. "onclick" is ignored. "onClick" is obeyed.
Comment 5 Ojan Vafai 2010-11-29 10:29:20 PST
This appears to work on trunk.
Comment 6 dharitri 2012-10-15 04:22:32 PDT
I have a form with a input type as submit and a onClick event which calls a function. The problem is, i have a one more input type file. When i upload a file the onClick event stops working. If i remove the uploaded file. The onclick event on the submit button works again. There are no errors shown. The form is submitted perfectly without the file upload. Don't understand what is happening here.
Comment 7 Ojan Vafai 2012-10-22 12:13:19 PDT
(In reply to comment #6)
> I have a form with a input type as submit and a onClick event which calls a function. The problem is, i have a one more input type file. When i upload a file the onClick event stops working. If i remove the uploaded file. The onclick event on the submit button works again. There are no errors shown. The form is submitted perfectly without the file upload. Don't understand what is happening here.

Please file a new bug and point to the broken page or upload a reduced test case.