Support

Account

Home Forums ACF PRO Are there JS triggers for when an acf_form() is submitting/completed/failed? Reply To: Are there JS triggers for when an acf_form() is submitting/completed/failed?

  • The only thing I see built into ACF is a filter that is called after validation is completed https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/#filters.

    You can probably look in json.errors to see if there was an error. There isn’t anything on the JS side of things that will be triggered after the page is submitted and the fields are updated. All of the update process happens in PHP

    On the PHP side, acf/save_post is always triggered and you can use this action before or after acf saves the values depending on the priority you set. https://www.advancedcustomfields.com/resources/acf-save_post/. Normally, acf redirects after all acf/save_post actions.

    You can potentially add a url query variable in to the acf return value in acf_form() and then have a ready event that looks for that value to determine what to do next. Or you could create an acf/save_post action and hijack the redirect and do your own redirect before ACF does it’s thing.