Welcome to WebmasterWorld Guest from 126.96.36.199 , register , free tools , login , search , pro membership , help , library , announcements , recent posts , open posts Become a Pro Member
Way to disable submit button once pressed? voltrader
I'd like to prevent multiple submissions.
Anyone have a bit of script to disable the submit button after it's pressed?
I've seen this done before.
Put this on the submit button:
Somehow I lose POST data when I use that JS clause in the submit like so:
<input type=submit name='sub' value='submit' onClick='this.disabled=true;return true;doSection(loading);'>
doSection displays an animated loading gif.
Just change the order:
<input type=submit name='sub' value='submit' onClick='this.disabled=true;doSection(loading);return true;'>
Thanks folks -- it's still not working. I've looked at the POSTed data with and without the JS and the contents look the same, but somehow the result is different.
The POSTed data with the submit-button-disabling-script is triggering my "invalid page request" routine, which basically looks at the POST/GET variables and checks whether or not that dynamic page exists. The difference has to be here, but I've stared at it too long over the past couple of days.
I'll have to let this one simmer a little before tackling it again.
Figured out why my script stopped working as expected after I included the disable-submit-button clause.
Turns out that data from any field that's disabled is NOT sent to the server.
Any ideas for a creative work-around to prevent multiple button presses?
<form name="someForm" action="whatever">
<input type="button" value="submit" name="submitButton" onclick="submitPressed()"> </form>
Would have to know what serverside you are using, as PHP or ASP solutions are more effective..
Thanks for the script Lobo. I'm using PHP.
I could check for a duplicate entry, but since I'm also accepting large photo files, I'd rather try to disable onClick.
Unless you meant something else by remarking about server-side solutions.
'Nother question about your script Lobo...
If the user has JS disabled, the submit-button is not disabled onClick and the form is still submitted, is that correct?