View Full Version : JS to disable form submit button?
07-07-2003, 07:24 PM
I would like to make sure users do not click the submit button on my form more than once.
:)thankx for your input!
07-07-2003, 07:32 PM
<input type="submit" id="mysub">
07-07-2003, 08:08 PM
More than once, per page visit or more than once a day/week/month/year?
The code above will take care of preventing someone from submitting the form twice per page visit, but it would take a simple page refresh to get around it.
07-07-2003, 08:13 PM
It's a useful trick though - it's amazing how many people double-click buttons and hyperlinks, and this can prevent forms from being submitted twice by mistake - with stuff like credit card purchases that can be quite serious.
07-07-2003, 08:22 PM
once per page visit is fine for a limit.
i tried implementing the code above but my form just wouldnt submit at all...
am still working on it.
07-07-2003, 08:30 PM
07-07-2003, 09:17 PM
<form onsubmit="this.elements['mysub'].disabled=true;return true;">
<input type="submit" name="mysub">
</form>Vladdy -- what? onsubmit is fired by any submission except one triggered by the form's submit() method.
07-07-2003, 09:31 PM
You are right - brainfart on my part.... :o
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.