To prevent forms from being submitted more than once I sometimes like to add a simple JavaScript function to the Submit button that disables the button when it is clicked. This does not provide a complete guarantee that the data is not sent twice, but it is effective at reducing the risk of multiple submissions.
Specifically here is an example of the JavaScript function:
<script language="javascript" type="text/javascript">
function handleFormSubmit(){
var btnInitiateProcess = document.getElementById('btnInitiateProcess');
btnInitiateProcess.style.display = 'none';
}
</script>
Then in the HTML of the submit button I add a call to the function as follows:
<input type="submit" id="btnInitiateProcess" onClick="handleFormSubmit()">
Leave a reply to Luvy Gonzalez Cancel reply