Skip to content

Instantly share code, notes, and snippets.

@mklasen
Created May 26, 2021 15:36
Show Gist options
  • Save mklasen/434a4589106fdd82f0006c986e38efbd to your computer and use it in GitHub Desktop.
Save mklasen/434a4589106fdd82f0006c986e38efbd to your computer and use it in GitHub Desktop.
Gravity Forms: Override the submit action so that the form can be submitted even when an unexpected callback was returned
// In this scenario a ZIP was returned upon form submission, because Gravity Forms
// does not expect this, the submit action is not reset.
// This snippet overrides the submit action.
document.addEventListener("DOMContentLoaded", function(){
const form = document.querySelector('form.generate-template');
const submit = form.querySelector('input.gform_button');
submit.addEventListener('click', function() {
form.submit();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment