Closed Bug 97085 Opened 23 years ago Closed 23 years ago

form is submitted twice when using onClick and submit

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 85286

People

(Reporter: mark, Assigned: rods)

Details

Attachments

(2 files)

From Bugzilla Helper: User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.2) Gecko/20010703 BuildID: 20010703 Using the JavaScript detailed below, a web form is submitted twice. Other browsers (Netscape 4.7, Konqueror 2.1.1, Mac IE 5), seem to submit just once using the same code. Reproducible: Always Steps to Reproduce: 1.Create a FORM with a submit button that calls a JavaScript function with onClick="function_name()" 2. Create a simple JavaScript function that submits the form: <script language="JavaScript"> function function_name () { document.form_name.submit(); } </script> 3. Submit the form Actual Results: The form appears to submitted twice. Presumably this because the browser doesn't quit after the JavaScript submit, but also processes the submit button submit request as well. Expected Results: Submit the form once and give up. I searched for "javascript submit twice" and "javascript submit double" and didn't find this bug already entered... :)
OK, the testcase works better if you save it locally and run it. The Bugzilla server does not like to receive the submit! <html> <head> <title>Bug 97085</title> <script language="JavaScript"> function submitForm() { document.form1.submit(); } </script> </head> <body> <form name="form1"> <input type="submit" onClick="submitForm();"> </form> </body> </html>
Confirming reported behavior with Mozilla binary 20010822xx WinNT. OS : FreeBSD --> All. When I save the testcase locally, load it and hit the Submit button, I get the usual alertbox warning "The information you have entered is to be sent over an unencrypted connection..." If I hit "Continue", I get this alertbox AGAIN -
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: FreeBSD → All
Assignee: rogerl → rods
Component: Javascript Engine → Form Submission
QA Contact: pschwartau → vladimire
This has nothing to do with JavaScript Engine. Reassigning to Form Submission for further triage. Not sure if this is actually a DOM or Event Handling issue, however -
Attached file CGI script for testing
Thanks for putting together the test case-- it's exactly what I was describing. That last trick is have the script it's submitted to do something that let's you know if it's been submitted once or twice. What's come to mind is a script that writes something simple in a log file or the web server error log. [ thinks for a moment. ]. The recently attached Perl script might help with this.
This looks like a duplicate of 85286... "multiple 'password save' and 'security warning' dialogs on page". Reopen if I'm wrong... *** This bug has been marked as a duplicate of 85286 ***
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → DUPLICATE
verifying
Status: RESOLVED → VERIFIED
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: