Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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