Skip to content

Instantly share code, notes, and snippets.

@chrisegg
Created February 12, 2022 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisegg/0bf6d0362f57bebe0539d8ef565cde1b to your computer and use it in GitHub Desktop.
Save chrisegg/0bf6d0362f57bebe0539d8ef565cde1b to your computer and use it in GitHub Desktop.
Allows you to auto-submit a form when the page loads, with a 1/2 second delay. Full tutorial here: https://gravityranger.com/auto-submit-form-page-load/
/**
* GravityRanger Auto-Submit Form on Page Load
*
* Allows you to auto-submit a form when the page loads, with a 1/2 second delay.
* https://gravityranger.com/auto-submit-form-page-load/
*
* @instructions:
*
* 1. Change gform_ID# to your forms ID number (line 24)
* 2. Set the amount of time you'd like to delay the script (line 27)
* 3. Add the scipt to an HTML field within your form
*
* @version 1.0
* @author GravityRanger
* @license GPL-2.0+
* @link http://gravityranger.com/
*
*
*/
<script type="text/javascript">
setTimeout(function(){
jQuery(document).ready(function(){
    jQuery('form#gform_ID#').trigger('submit'); //change ID to your forms ID# number
});
}, 500); //seconds before submit (1000 = 1 second)
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment