Created
May 26, 2021 15:36
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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