Open
Bug 84833
Opened 24 years ago
Updated 2 years ago
calling self.close() right after calling submit() cancels submission
Categories
(Core :: DOM: Forms, defect, P3)
Core
DOM: Forms
Tracking
()
NEW
mozilla1.1alpha
People
(Reporter: hstory, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 10 obsolete files)
(deleted),
text/html
|
Details |
We have a popup window that has a submit element and a button. On clicking
either button we would like the window to close. There does not seem to be a way
to do this.
Our html engineers have tried:
1. placing a <a href=".." onlclick=this.close()><input...></a>
2. using the onclick in <input ... onlick=this.close()>
3. using the onsubmit in the form element <form ... onsubmit=...>
All of these work with Internet Explorer. and are part of the standard spec.
I can conceive that there may be a problem with 1: which should be called first
the "<a href" action or the input submission action. But the other two options
are not problematic.
This may be a duplicate of 67875. But I was not quite sure, as the xhtml
references are missing. I will attach the two problem files.
Henry
Comment 5•24 years ago
|
||
I am not sure really what to do with this bug. Still a problem in the latest
nightlies?
Comment 6•24 years ago
|
||
alright.... Here's the problem as I see it.
When a button is clicked (a submit button for a form), I would expect any
onclick event for the button to be processed first.
Once the onclick event is processed, the window is gone, and what is there to
submit?
To get this to work in all browsers, I would suggest having an onclick event
handler that first calls the form's submit() method and only after that calls
window.close()... All that said, over to DOM events for investigation. Should
we be processing the submit() at all here? If the window.close() returns success?
Status: UNCONFIRMED → NEW
Component: Event Handling → DOM Events
Ever confirmed: true
QA Contact: madhur → vladimire
Comment 7•23 years ago
|
||
-> moz 1.1, 4.x and IE compatibility issue
Target Milestone: --- → mozilla1.1
this problem is deeper than simply closing windows: onsubmit and/or onclick
allows one to verify form inputs before the form is actually submitted. this
seriously breaks forms with required fields - mozilla submits the form with
blank entires, while IE/others present the user with a warning. Example code below:
function validate() {
if (formthing.elementname.value == "") {
alert("You must enter somthing.");
event.returnValue=false;
formthing.elementname.focus();
}
}
<FORM ACTION="file.php" NAME="formthing" METHOD="post" onsubmit="validate();">
<INPUT TYPE="Text" name="elementname">
<INPUT TYPE="Submit" value="Submit">
</FORM>
Comment 9•23 years ago
|
||
Comment 8 has buggy code... "event.returnValue=false;" is an IE-ism. The global
event object is something IE sort of made up.
If your "validate" function took an argument and your handler definition passed
it an event like so:
onsubmit="validate(event);"
then you could call event.preventDefault() in the handler to prevent the efault
action (this is the correct way per the DOM Events module).
Or your handler should return "false" for cases when you want to prevent the
action.
Comment 10•23 years ago
|
||
Comment 11•23 years ago
|
||
Comment 12•23 years ago
|
||
Comment 13•23 years ago
|
||
Comment 14•23 years ago
|
||
Comment 15•23 years ago
|
||
Comment 16•23 years ago
|
||
These test cases work with a 2002-02-06-03/win2k build and a very old
2001-11-10-06/Linux build. I am getting a newer Linux build, but this looks like
a works for me. Anyone disagree?
Comment 17•23 years ago
|
||
looks like this works in Linux 2002 02 08 07 trunk build as well. Can we mark
this wfm and get it off the radar?
Comment 18•23 years ago
|
||
This attachment opens a new window, submits the form with the target set to the
new window and closes the opener window.
On netscape 6.2 and mozilla 0.9.7 (win95/98/linux) the new window is opened but
the submit action doesn't take place. On IE it works.
Comment 19•23 years ago
|
||
jkeiser, could you test that last testcase with the new form submission code?
I can reproduce the problem in Roger's testcase. I get the alert asking me
whether I'm sure I want to submit insecurely and then the window closes and no
submission happens.
Note that putting the close() call on a timeout ("setTimeout(self.close, 0)")
will make the form submit....
Comment 20•23 years ago
|
||
bz, i see what you mean, but can we clean this bug up so the summary means
something?
Change "onsubmit in form element does not work, neither does onclick help" to
"race between form submit and window.close" perhaps?
Also, the last test case is reproducible in Win2k with or without using a
password field, so I recommend OS -> ALL.
Updated•23 years ago
|
OS: Linux → All
Hardware: PC → All
Summary: onsubmit in form element does not work, neither does onclick help. → calling self.close() right after calling submit() cancels submission
Comment 21•22 years ago
|
||
Attachment #37737 -
Attachment is obsolete: true
Attachment #37738 -
Attachment is obsolete: true
Attachment #37741 -
Attachment is obsolete: true
Attachment #68994 -
Attachment is obsolete: true
Attachment #68995 -
Attachment is obsolete: true
Attachment #68997 -
Attachment is obsolete: true
Attachment #68998 -
Attachment is obsolete: true
Attachment #68999 -
Attachment is obsolete: true
Attachment #69000 -
Attachment is obsolete: true
Attachment #69035 -
Attachment is obsolete: true
Comment 22•22 years ago
|
||
-> form submission
Assignee: joki → jkeiser
Component: DOM Events → Form Submission
Updated•22 years ago
|
Priority: -- → P2
Comment 23•22 years ago
|
||
Dup of bug 93694?
Comment 24•22 years ago
|
||
*** Bug 93694 has been marked as a duplicate of this bug. ***
Comment 25•22 years ago
|
||
*** Bug 187554 has been marked as a duplicate of this bug. ***
Comment 26•18 years ago
|
||
*** Bug 356553 has been marked as a duplicate of this bug. ***
Updated•18 years ago
|
Assignee: john → form-submission
QA Contact: vladimire → ian
Updated•18 years ago
|
QA Contact: ian → vladimire
Updated•15 years ago
|
Assignee: form-submission → nobody
QA Contact: vladimire → form-submission
Comment 27•6 years ago
|
||
Moving to p3 because no activity for at least 1 year(s).
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
Assignee | ||
Updated•6 years ago
|
Component: HTML: Form Submission → DOM: Core & HTML
Updated•3 years ago
|
Component: DOM: Core & HTML → DOM: Forms
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•