Last active
February 20, 2025 18:58
-
-
Save Crocoblock/93f2f3d25a1acedf99af6744467aebfa to your computer and use it in GitHub Desktop.
JetFormBuilder JS
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
//jQuery submit success | |
jQuery( document ).on( 'jet-form-builder/ajax/on-success', function( event, response, $form ) { | |
//do something | |
} ); | |
//wp hook on submit | |
//https://gist.github.com/Crocoblock/d6d1828a785ad55addb8f497deb7f3ba | |
//to get Observable that represents the form with ID of 128 | |
let observable = JetFormBuilder[128]; | |
//get all form inputs into array | |
let inputs = observable.getInputs(); | |
//to get field with 'email' name | |
let email = observable.getInput( 'email' ); | |
//to set 'email' field in this form to some value | |
email.value.current = '[email protected]' | |
//clear input | |
email.onClear(); | |
//to submit the form on some input value change (say, you have a form which contains only one select field, | |
//and its change should trigger submit) | |
let unitType = observable.getInput( 'unit_type' ); | |
unitType.value.watch( function() { | |
observable.form.submit() | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment