hitting f5 after hitting the submit button

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
cali_dotcom
Forum Commoner
Posts: 49
Joined: Fri Aug 22, 2008 7:28 pm
Location: Rancho Cucamonga, CA

hitting f5 after hitting the submit button

Post by cali_dotcom »

i have a php application where users can apply for a bonus. but there is a confirmation page before the bonus redemption code runs. the issue is that in IE, if you hit f5 right after you click the continue button, the confirmation page refreshes while the bonus redemption code had already been triggered by the continue button and actually goes through. but because the user still sees the confirmation page, they would hit the continue button again and now they get an error cause they are already registered.

is there a way i can disable the f5 button using javascript? is this the best way to go about this? i have tried many scripts i found online to do this, but none of them achieves it. is there a better way i can go about this? perhaps from the application side?

any input will be appreciated.
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: hitting f5 after hitting the submit button

Post by social_experiment »

http://www.daniweb.com/web-development/ ... in-mozilla
^ Could be useful.

That said, remember that javascripts' state (on or off) isn't determined by you but by the browser of the user so even with this code stooping f5 use it might not stop the issue. An server side alternative might be the way to go.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: hitting f5 after hitting the submit button

Post by Christopher »

Usually the solution to refresh resubmit problems is to redirect to a different URL after submit. Then refresh does not resubmit.
(#10850)
Post Reply