perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Howe <e...@pieinsky.ca>
Subject Re: Any success with storing photos in a database? (prevents double-submits)
Date Thu, 16 Oct 2008 03:45:58 GMT
On Oct 15, 2008, at 11:11, Cosimo Streppone wrote:

> On Wed, Oct 15, 2008 at 12:31 PM, Mark wrote:
[...]
> Then Perrin wrote:
>
>> JavaScript is okay, but can be a problem when people hit back
>> expecting to use the form again and the button is still disabled.
>
> You could always trigger some javascript event on page load
> the re-enables the submit control, even if already enabled,
> resetting the flag to "0". This is what I did.

I do it this way (via jQuery) and it works okay even when faced with  
the browser's back-button:

	function returnFalse() {
	        return false;
	}
	$(document).ready(function() {
	        // Take care of back-button issues first.
         	$('form').find(':submit').unbind('click', returnFalse);
         	// Then wire up the auto-disabling stuff.
         	$('form').submit(function() {
         	        $(this).find(':submit').click(returnFalse);
         	        return true;
         	});
	});

I don't use the 'disabled' attribute as that prevents the browser (at  
least some of them) from sending the button back to the server with  
the rest of the form.

Eric Howe
eric@pieinsky.ca


Mime
View raw message