Preventing a user from submitting a form twice and creating multiple entries server side, is a common problem online. I didn't see feature for Gravity Forms to prevent this. So I've tried to figure out a way to use Hooks and Filters to accomplish this. I've read some posts on this, but can't figure out what to do. Nothing seems to work. Anyone have any ideas?
My two ideas for code now are as follows (why don't these work - nothing happens when I submit the form):
IDEA1 (Javascript)
function pre_submission_double($form){
?>
<script type="text/javascript"><!--
function doSubmit() {
document.gform_1.gform_submit_button_1.disabled = 'disabled';
document.gform_1.gform_submit_button_1.value = 'Processing. This may take several minutes...';
}
//-->
</script>
<?php
}
add_action("gform_pre_submission_1", "pre_submission_double");
IDEA2 - just change name and maybe add CSS
-----------------------------------------------------------
/* Try to Prevent Double Submission by changing name of buttton*/
function pre_submission_double($form){
//rename button after submission
$form["button"]["text"] = 'Processing';
//returning modified form object
return $form;
}
add_filter("gform_pre_submission_filter_1", "pre_submission_double");