Last active
April 16, 2025 09:23
-
-
Save Crocoblock/d6d1828a785ad55addb8f497deb7f3ba to your computer and use it in GitHub Desktop.
JetFormBuilder Do something on form submit
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
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set the jetnegine visibility conditions on the form.