IE Javascript event nightmare

I thought it would be nice to disable a forms submit button once it was pressed once to prevent impatient users from clicking again and again if the post might take longer as expected.

<input type="submit" value="Send" onclick="this.disabled=true"/>

But as I noticed IE6 doesn’t like that. After disabling the submit it cancels the submit of the page – leaving the user on a page with a disabled submit button. How great is that ?

The solution:

After disabling the button you have to submit the form using JavaScript.
So the buttons HTML code now looks like this:

<input type="submit" value="Send"
onclick="this.disabled=true;document.myform.submit()"/>
Advertisements
This entry was posted in HTML/JS and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s