[SHARE] Gravity Forms with AJAX, conditional logic, page transitions (compatible with Barba.js, Taxi.js, Highway.js, ...)

Hello community,

I wanted to share my findings regarding the use of Gravity Forms with AJAX, particularly compatible with page transitions. I’ve gone through many topics related to this subject due to various issues I encountered:

Since most of them are closed to new replies, I’m creating this topic.

Here’s the code in question: https://gist.github.com/Striffly/fa79b85901dd6c98a8075a35d7dc45ee

The following code enables the use of Gravity Forms (2.8.7 as of now) with the following features:

  • AJAX loading
  • Functional with page transitions (Barba.js, Taxi.js, Highway.js)
  • Enqueue conditional logic scripts
  • Keep the form displayed after submission
  • Works with reCAPTCHA (with recent version of Gravity Forms reCAPTCHA Add-On, scripts are automatically enqueued).
  • Scripts moved to footer (optional)

The code was initially integrated into projects using roots/sage. I adapted the code for integration into “vanilla” WordPress projects but without testing it, so feel free to let me know if there are any errors in the comments of this topic or directly on GitHub!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.