CodeIgniter Forums
Multiple form submissions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: Multiple form submissions (/showthread.php?tid=3081)



Multiple form submissions - El Forum - 09-08-2007

[eluser]Unknown[/eluser]
I am looking for a way to intelligently handle what happens when a user repeatedly pounds on a form's submit button. Is there anything built into CI that can help with this?

I've been considering seeding the form with a secret code that's also stored in the session. When the form gets submitted with a code that matches the code that's in the session, processing is done and the session code is cleared, which causes extra submits to be ignored. The problem with this is that if the user then goes back to the original form via the back button, retrieving the page from the cache, complete with the orignal secret code, and tries to submit a new form, perhaps with different info, the submission will be ignored.

I've also considered javascript solutions, such as disabling the submit button, but there's no guarantee the user will have javascript enabled and server-side logic would be required anyhow.

Any thoughts would be greatly appreciated!


Multiple form submissions - El Forum - 09-08-2007

[eluser]Rick Jolly[/eluser]
You might be interested in this thread, which shows how to add headers so that browsers won't cache pages:
http://ellislab.com/forums/viewthread/51313/#250141