Fix for Typo Scribbish theme v2 - aka disabling a submit button in IE 2

Posted by Tim Connor Thu, 26 Oct 2006 17:11:00 GMT

I looked into it a little more this morning, and came up with how to still get the submit button disabling, to avoid double-posts, without having to rework anything substantially.


<%= submit_tag 'Submit', :onclick => "$('commentform').onsubmit();this.disabled=true;Element.hide('preview');return false;"%>

You first call the form’s onsubmit, since IE won’t call it if you submit the form via JavaScript, then you prevent browsers that don’t cancel the form when you disable the submit button from double-submitting, by returning false at the end.

This should still work with javascript off, if you have the “Allow non-Ajax comments” setting turned on.

  1. Tim Connor about 5 hours later:

    Safari 1.3.2

  2. Tim Connor about 23 hours later:

    wo0t. My fix has been committed to Typo trunk.

    Revision 1979 : “Applied Tim Connor’s fix for commenting with IE to a Scribbish themed blog. Thanks Tim.”

Comment form

(leave url/email »)

Help with Textile (code)