We are hosting wordpress sites on wpengine. On this one site we are using gravity forms but for some reason it stopped working. All we get is a js error
Uncaught ReferenceError: gformInitSpinner is not defined (index):135
(anonymous function) (index):135
o jquery.min.js:2
p.fireWith jquery.min.js:2
e.extend.ready jquery.min.js:2
c.addEventListener.B
Now if I set up the site on my local machine it works perfectly fine. Has anyone come across this problem? Anyone got any idea why this is happening?
The most common cause of this issue is the gravityforms.js file being included down in the footer when it should be up in the header.
If you are embedding the form using the function call there is a second function call you should use to include the scripts and stylesheets in the header.php
https://docs.gravityforms.com/gravity_form_enqueue_scripts/
I had exactly the same problem, and managed to track it down to some theme code.
I was using the bones theme, which de-registers the default jQuery JS and adds its own using the Google CDN, like:
As you can see, it
deregister
‘s the defaultjquery
script, and then adds its owncdn-jquery
script, which is fine, apart from the fact that the Gravity forms scripts have a dependency onjquery
and notcdn-jquery
!Because they can’t see the default
jquery
script, they don’t load, and it would seem that they fail silently, simply emitting this JavaScript error because said JavaScript is loaded without checking dependencies.In any case, I fixed it by re-naming the bones register script to
jquery
, might not be the best way to fix this, but it works.Alternatively, commenting out both pieces of code would also fix this (and leave the default WordPress JS in there).
Not sure if other themes do this, but might be worth doing a search all in your theme for
wp_deregister_script('jquery');
or at least switching to the default theme to see if you experience the same problem (that’s how I pinpointed this).OK I solved the problem. For some reason the file form_display.php was for some reason not up to date. So I simply pushed that one file to the server and this fixed it.
You can also add the GF`s necessary scripts manually to header.php (no actions with registering/deregistering jQuery needed!). Example:
I just had this problem and, in my case, it was caused by CloudFlare RocketLoaderâ¢.
After I disabled it, the form loaded with no problem.
Move Gravity forms` scripts to footer