Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Last active September 17, 2025 08:23
Show Gist options
  • Select an option

  • Save Crocoblock/93f2f3d25a1acedf99af6744467aebfa to your computer and use it in GitHub Desktop.

Select an option

Save Crocoblock/93f2f3d25a1acedf99af6744467aebfa to your computer and use it in GitHub Desktop.
JetFormBuilder JS
//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 = 'test@gmail.com'
//clear input
email.onClear();
// to get field with 'number' name
let number = observable.getInput( 'number' );
// set value
number.value.current = 100;
// set min attr
number.attrs.min.value.current = 100;
// set max attr
number.attrs.max.value.current = 100;
//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()
} );
@eclipses
Copy link

When changing min and max as from the example this is generating a validation error, is there a way to bypass the validation?

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