Closed
Bug 277890
Opened 20 years ago
Closed 17 years ago
disabling BUTTON after form.submit() prevents submission
Categories
(Core :: DOM: Events, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.9alpha8
People
(Reporter: ajschult784, Assigned: smaug)
References
()
Details
(Keywords: helpwanted, regression, testcase)
Attachments
(4 files)
|
429 bytes,
text/html
|
Details | |
|
4.40 KB,
patch
|
bryner
:
review-
|
Details | Diff | Splinter Review |
|
6.27 KB,
patch
|
smaug
:
review-
|
Details | Diff | Splinter Review |
|
10.45 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
This appears to be a close cousin of bug 242709, for BUTTON elements instead of INPUT/submit buttons. A BUTTON whose javascript action submits the form and then disables the BUTTON does not successfully submit the form. State Farm's website seems to use this type of structure quite a bit. This regressed between linux trunk 2004042807 and 2004050105 (bug 60212).
| Reporter | ||
Comment 1•20 years ago
|
||
testcase exhibits the bug with linux trunk 2005010905 clicking "Submit" disables the button and does not submit the form.
Comment 2•20 years ago
|
||
I think doing the clickOrExtActivate thing a la bug 242494 should fix this.... mrbkap, feeling bored? ;)
Keywords: helpwanted
Comment 3•19 years ago
|
||
*** Bug 307679 has been marked as a duplicate of this bug. ***
Comment 4•19 years ago
|
||
*** Bug 311105 has been marked as a duplicate of this bug. ***
(In reply to comment #4) > *** Bug 311105 has been marked as a duplicate of this bug. *** Almost exactly the same, except that, in that case, the button is disabled before submitting the form, and not after.
BTW, the bug seems to appear only when using the <BUTTON> tag and not the <INPUT type=button> tag.
Comment 7•19 years ago
|
||
Yes, of course. See comment 0 and the bugs listed therein.
Flags: blocking1.9a1+
Comment 8•19 years ago
|
||
*** Bug 322503 has been marked as a duplicate of this bug. ***
Comment 9•19 years ago
|
||
So, appr. something like this? It seems to make the testcase work. I'm getting an assertion in a debug build, btw, with https://bugzilla.mozilla.org/attachment.cgi?id=197421 (from bug 309348), I've filed this as bug 322908.
Comment 10•19 years ago
|
||
That doesn't look much like the <input> code... might be equivalent, but ask bryner to review?
Comment 11•19 years ago
|
||
Comment on attachment 208072 [details] [diff] [review] patch? I don't really know this code, so this might be totally wrong.
Attachment #208072 -
Flags: review?(bryner)
Updated•19 years ago
|
Flags: blocking1.8.1?
Comment 12•19 years ago
|
||
Bryner - can you take a look at the patch
Flags: blocking1.8.1? → blocking1.8.1+
Comment 13•18 years ago
|
||
Removing from blocking list as we likely wouldn't block the release for this - but would really like this if patch it suitable for the branch
Flags: blocking1.8.1+ → blocking1.8.1-
Attachment #208072 -
Flags: superreview?(bugmail)
Flags: blocking1.9+
Comment 14•18 years ago
|
||
Comment on attachment 208072 [details] [diff] [review] patch? It's been awhile since I've looked at this code, but won't this break invoking form submission by dispatching a DOMActivate event to the button?
Attachment #208072 -
Flags: review?(bryner) → review-
Comment 15•18 years ago
|
||
bryner, that patch just sets up the same code in nsHTMLButtonElement as we had in nsHTMLInputElement (although the patch has completely rotted due to the event landing on trunk). The nsHTMLInputElement code is code you wrote in bug 242494. You said it "does not regress any of the DOMActivate tests", so I assume you have some. Can you point them out, so that someone could test the patch for this bug against them (and hence maybe answer your question)?
Comment 16•18 years ago
|
||
(In reply to comment #15) > bryner, that patch just sets up the same code in nsHTMLButtonElement as we had > in nsHTMLInputElement (although the patch has completely rotted due to the > event landing on trunk). The nsHTMLInputElement code is code you wrote in bug > 242494. You said it "does not regress any of the DOMActivate tests", so I > assume you have some. Can you point them out, so that someone could test the > patch for this bug against them (and hence maybe answer your question)? > That's the problem I don't think the code is the same. In nsHTMLInputElement, clickOrExtActivate is set to true if we're in a click, _or_ if we're in DOMUI_ACTIVATE, as long as it's not the DOMActivate _caused_ by the click. This patch to nsHTMLButtonElement seems to only perform the submit if the event was a click.
Comment 17•18 years ago
|
||
Ah, ok. Martijn, do you have time to update the patch to trunk and the review comments?
Updated•18 years ago
|
Assignee: bryner → events
Attachment #208072 -
Flags: superreview?(bugmail) → superreview?
Attachment #208072 -
Flags: superreview?
Flags: blocking1.9a1+
Martijn, will you be able to fix this for 1.9?
Assignee: events → martijn.martijn
Comment 19•18 years ago
|
||
Sorry, I looked at this code, but I don't really know this code. It's hard for me to do the similar thing for nsHTMLButtonElement as is done for nsHTMLInputElement, because the code is quite different (not only named differently).
Assignee: martijn.martijn → jonas
Target Milestone: --- → mozilla1.9beta1
Comment 20•18 years ago
|
||
I also added a testcase for bug 242709 which is exactly the same as the one for this bug, except it uses an <input> instead of a <button>.
Attachment #267181 -
Flags: review?(sayrer)
Comment 21•18 years ago
|
||
Comment on attachment 267181 [details] [diff] [review] Mochitest test Smaug, since you're a content peer, could you review?
Attachment #267181 -
Flags: review?(sayrer) → review?(Olli.Pettay)
| Assignee | ||
Comment 22•18 years ago
|
||
But we can't take that test yet, because it hangs mochitest. Testcase for 277890 doesn't fail or pass.
| Assignee | ||
Comment 23•18 years ago
|
||
Comment on attachment 267181 [details] [diff] [review] Mochitest test So could you make the todo() to actually work. At least for me mochitest just hangs.
Attachment #267181 -
Flags: review?(Olli.Pettay) → review-
| Assignee | ||
Comment 24•17 years ago
|
||
Taking. Jonas, if you already have the patch, feel free to take this back :)
Assignee: jonas → Olli.Pettay
| Assignee | ||
Comment 25•17 years ago
|
||
This is almost copy-paste from nsHTMLInputElement.
Attachment #276899 -
Flags: superreview?(bzbarsky)
Attachment #276899 -
Flags: review?(bzbarsky)
| Assignee | ||
Updated•17 years ago
|
Status: NEW → ASSIGNED
| Assignee | ||
Comment 26•17 years ago
|
||
Better to fix this first before starting to change when DOMActivate is dispatched (bug 127903)
Blocks: 127903
Comment 27•17 years ago
|
||
Comment on attachment 276899 [details] [diff] [review] make button to work like input type="submit" Shouldn't we only flush the pending submission if we're in an outer activate? Or am I misreading the input code?
| Assignee | ||
Comment 28•17 years ago
|
||
(In reply to comment #27) > (From update of attachment 276899 [details] [diff] [review]) > Shouldn't we only flush the pending submission if we're in an outer activate? NS_IN_SUBMIT_CLICK is set only when in outer activate, so flush happens only in outer activate when event was prevented. And if the event wasn't prevented, then dispatch 'submit' to form. I could add a comment about NS_IN_SUBMIT_CLICK.
Comment 29•17 years ago
|
||
Comment on attachment 276899 [details] [diff] [review] make button to work like input type="submit" With comment, looks ok, though I admit that I didn't double-check every niggling detail....
Attachment #276899 -
Flags: superreview?(bzbarsky)
Attachment #276899 -
Flags: superreview+
Attachment #276899 -
Flags: review?(bzbarsky)
Attachment #276899 -
Flags: review+
| Assignee | ||
Updated•17 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•