Bug 14443

Summary: Forms dont submit when disabling submit button
Product: WebKit Reporter: Zachary Allia <allia.z>
Component: FormsAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ap, darren, dglazkov, kaustubh.ra, rniwa, rsesek, tkent
Priority: P2    
Version: 523.x (Safari 3)   
Hardware: Mac   
OS: OS X 10.4   
URL: http://gifts.30boxes.com/broken.html
Bug Depends on:    
Bug Blocks: 39021    
Attachments:
Description Flags
test case none

Description Zachary Allia 2007-06-27 22:25:58 PDT
Forms do not submit when disabling the submit button via an onclick event, even when returning true.
Comment 1 Alexey Proskuryakov 2007-07-19 05:32:20 PDT
Created attachment 15579 [details]
test case
Comment 2 Alexey Proskuryakov 2007-07-19 05:33:48 PDT
Confirmed with r24182. Works in Firefox.
Comment 3 Robert Sesek 2008-08-21 08:43:15 PDT
This is a regression from fixing https://bugs.webkit.org/show_bug.cgi?id=9245. Not sure how to go about fixing this, though...
Comment 4 GĂ©rard Talbot 2008-08-31 17:12:02 PDT
This bug seems to be the exact opposite of bug 16886. You guys should be talking to each others to sort this out because both bugs can not be confirmed.
Comment 5 Kaustubh Atrawalkar 2011-09-27 05:12:52 PDT
This seems to be old but existing issue. During initial implementation of SubmitInputType::handleDOMActivateEvent (revision - 72059 -http://trac.webkit.org/changeset/72059/trunk/WebCore/html/SubmitInputType.cpp)

There was check added to see if submitButton->disabled() but this line will never hit infact the function will not be called if the button is disabled. In the use case, the onclick script it handled first making the button disabled and then continued to handleDOMActivateEvent where it returns due to disabled submitButton. Should be removed that check. Attaching patch.
Comment 6 Ryosuke Niwa 2011-09-27 09:18:33 PDT
Does IE submit in this case?
Comment 7 Kaustubh Atrawalkar 2011-09-27 10:39:16 PDT
(In reply to comment #6)
> Does IE submit in this case?

Nope. only Firefox has does complete form submission.
MSIE & Opera does not. I think we might need to clear out again about this.
Comment 8 Ryosuke Niwa 2011-09-27 10:45:19 PDT
(In reply to comment #7)
> (In reply to comment #6)
> > Does IE submit in this case?
> 
> Nope. only Firefox has does complete form submission.
> MSIE & Opera does not. I think we might need to clear out again about this.

Yes, we definitely need to figure out the right behavior on whatwg. Intuitively, I wouldn't expect the form to submit when the only submit button is disabled. This may as well as considered as a Gecko bug.
Comment 9 Kaustubh Atrawalkar 2011-09-27 10:52:37 PDT
(In reply to comment #8)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > Does IE submit in this case?
> > 
> > Nope. only Firefox has does complete form submission.
> > MSIE & Opera does not. I think we might need to clear out again about this.
> 
> Yes, we definitely need to figure out the right behavior on whatwg. Intuitively, I wouldn't expect the form to submit when the only submit button is disabled. This may as well as considered as a Gecko bug.

If you suggest, I will mail on whatwg for this issue. IMHO, until and unless form submit is not disabled, form submit action should happen on the click. But not sure with the compatibility of the browsers.
Comment 10 Ryosuke Niwa 2011-09-27 11:11:47 PDT
By the way, could you add yourself to committers.py so that Bugzilla's auto-completion can recognize you. Also, listing your IRC nick name will allow me to talk to you on #webkit more easily :)
Comment 11 Ryosuke Niwa 2011-09-27 11:17:52 PDT
ap suggests I add you myself. What's your IRC nickname?
Comment 12 Kaustubh Atrawalkar 2011-09-27 11:21:39 PDT
(In reply to comment #11)
> ap suggests I add you myself. What's your IRC nickname?

Sure, my IRC nickname is silverroots
Comment 13 Kaustubh Atrawalkar 2011-09-28 00:22:42 PDT
(In reply to comment #12)
> (In reply to comment #11)
> > ap suggests I add you myself. What's your IRC nickname?
> 
> Sure, my IRC nickname is silverroots

Thanks Ryosuke :)
Comment 14 Kaustubh Atrawalkar 2011-09-29 21:06:32 PDT
(In reply to comment #8)
> 
> Yes, we definitely need to figure out the right behavior on whatwg. Intuitively, I wouldn't expect the form to submit when the only submit button is disabled. This may as well as considered as a Gecko bug.

in this case, the submit button is active before clicking it, but on it's on click handler it is made disabled. Firefox seems to run both on click and on submit handlers in this case one followed by another.
Comment 15 Kaustubh Atrawalkar 2012-03-07 22:21:45 PST
The whatwg discussion thread - http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-January/034536.html

As per Ian, we should be fixing this issue. Will provide a patch soon.
Comment 16 Darren Powers 2012-03-15 23:52:03 PDT
I seems to be having the same problem with links.
On click event if I disable the link I would still expect the event to bubble and route the browser to the href value but nothing happens.
Comment 17 Kaustubh Atrawalkar 2012-03-16 01:25:56 PDT
(In reply to comment #16)
> I seems to be having the same problem with links.
> On click event if I disable the link I would still expect the event to bubble and route the browser to the href value but nothing happens.

Yes, this might have issues with most of the elements. I am assuming handleDOMActiveEvent should be modified to make it more smarter so that it can handle such cases. Not sure thought.