[whatwg] Forms dont submit when disabling submit button

On Tue, 27 Sep 2011, Kaustubh Atrawalkar wrote:
>
> A simple use case -
> 
> <form action="javascript:alert('SUCCESS')">
> <input type="submit" onclick="this.disabled=true; return true;">
> </form>

(Note: This isn't a "use case", it's a sample. A use case is a description 
of the reason why an author or user wants to do something.)


> This does not submit the form in IE, Opera or Webkit but in firefox it 
> does show alert. Considering generic behavior of HTML5 forms, until and 
> unless submit button is active submit action should also be followed by 
> onclick event on submit button. Just need to get what can be the exact 
> behavior here?

The "this.disabled=true" bit should have no effect on the submission 
(since the click has already occurred), and the "return true" part of the 
event handler should have no effect at all.

Thus, assuming the user only clicks once, the above should be equivalent 
to:

 <form action="javascript:alert('SUCCESS')">
  <input type="submit">
 </form>

Thus, Firefox is correct here, and WebKit and Opera are wrong. (I didn't 
test IE.)

I recommend filing bugs.

HTH,
-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Thursday, 26 January 2012 14:53:10 UTC