js error on gravity forms

stephan2307 picture stephan2307 · May 21, 2014 · Viewed 30.5k times · Source

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?

Answer

richardW8k picture richardW8k · May 21, 2014

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

// gravity_form_enqueue_scripts($form_id, $ajax);
gravity_form_enqueue_scripts(4, true);

https://docs.gravityforms.com/gravity_form_enqueue_scripts/