The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

Run JavaScript before submit


This Discussion is public


Can you run a JavaScript API call before submit and based on the result either save form data or show an error message if the API call fails? Do I need an additional add-on to make this happen?

You can do it just with jQuery. You can use event.preventDefault() to stop the form submit, run your code, then manually trigger a form submit when your code is successful. The basic function is:

$("#btnSubmit").on("click", function (e) {

/* on success */

Thank you!

Discussion closed.