MyBB Community Forums

Full Version: Disable button after click submit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Heloo there,

I happens something, espcially with slow connection that you click for example Post Thread, u wait a little then click it again, to find that you have posted the same 1 twice.

So it would be nice that when you click anyof these buttons to have it disabled, so u can't click anymore.

it is something can be done using Java Scripts

function postthread(param) {
        param = document.getElementById(param);
        param.disabled = true;
        param.value="Posting...";
}

and in the form you can add something like
onsubmit="postthread('submitbutton');"

it would be nice to have that.

regards
I haven't tried, but isn't it possible to do something like this:

<input type="submit" value="Post Thread" onsubmit="this.disabled=true;this.value='Posting...'" />
Well i tried that quickly but the bottom weren't disabled
What if you submit a thread and get an error message ("subject too long" or whatever), then go back to fix it, and find that you can't re-submit the form? Toungue
Then you call WDZ for help Toungue
[Image: wavespam.gif]
Then button only get's disabled when U click it and start submiting!

anyof u has myspace account ? check the buttons there, or no try to upload an image over http://tinypic.com, maybe this explains more what i meant
Yeah but the point WDZ is trying to make is that if you get an error, and you click the <back> button on your browser, the button would be disabled, and you can't click it again.

Would a body onload="button.disabled=false" work?
You just write decent javascript which will also set it to disabled=false when the page loads.

Simple.
Chris Boulton Wrote:You just write decent javascript which will also set it to disabled=false when the page loads.

Simple.
But is using the Back button always considered a "load"? Opera goes back so instantly that I doubt it reloads anything... :\
Pages: 1 2