Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Last active April 16, 2025 09:23
Show Gist options
  • Save Crocoblock/d6d1828a785ad55addb8f497deb7f3ba to your computer and use it in GitHub Desktop.
Save Crocoblock/d6d1828a785ad55addb8f497deb7f3ba to your computer and use it in GitHub Desktop.
JetFormBuilder Do something on form submit
<script>
document.addEventListener( 'DOMContentLoaded', function() {
const {
addAction,
} = window.JetPlugins.hooks;
addAction( 'jet.fb.observe.after', 'example/onSubmit', init );
function init( observable ) {
//save form id to status ReactiveVar
observable.form.submitter.status.formId = observable.form.getFormId();
observable.form.submitter.status.watch( onFormSubmit );
}
function onFormSubmit() {
//log status and form id to console
console.log( this.current, this.formId );
}
} );
</script>
@whois-plt
Copy link

hi! is there a way to target a specific JetForm? in case there are multiple forms on a page

@franitpro
Copy link

Set the jetnegine visibility conditions on the form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment