Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

js error on gravity forms

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?

like image 936
stephan2307 Avatar asked May 21 '14 14:05

stephan2307


People also ask

Why is my gravity form not showing up?

Why is 'display:none' being added and my form isn't showing up? This is because you have conditional logic being used on your form. Anytime conditional logic is present the entire form is set to display: none; and then JavaScript is used to only show the fields that should be shown.

How do you add gravity forms to JavaScript?

Finally, there is an easy way to add custom Javascript to your Gravity Forms that only loads when the form is rendered. Just copy-and-paste your desired snippet into the robust editor on your Form Settings and you're golden.

How do I enable Ajax in gravity forms?

Enabling Gravity Forms AJAX in the Block EditorStart by editing the page where your form is embedded. Next, locate the “Gravity Forms” block and click on it to open the Block Settings in the right-hand panel. Now open the “Advanced” settings panel and toggle “AJAX” on.

Is gravity form down?

Gravityforms.com is UP and reachable by us.


2 Answers

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/

like image 160
richardW8k Avatar answered Sep 27 '22 20:09

richardW8k


You can also add the GF`s necessary scripts manually to header.php (no actions with registering/deregistering jQuery needed!). Example:

<link rel='stylesheet' id='gforms_formsmain_css-css'  href='/wp-content/plugins/gravityforms/css/formsmain.min.css' type='text/css' media='all' />
<link rel='stylesheet' id='gforms_ready_class_css-css'  href='/wp-content/plugins/gravityforms/css/readyclass.min.css' type='text/css' media='all' />
<link rel='stylesheet' id='gforms_browsers_css-css'  href='/wp-content/plugins/gravityforms/css/browsers.min.css' type='text/css' media='all' />
<script type='text/javascript' src='/wp-content/plugins/gravityforms/js/jquery.json-1.3.js'></script>
<script type='text/javascript' src='/wp-content/plugins/gravityforms/js/gravityforms.min.js'></script>
like image 22
Andrews32 Avatar answered Sep 27 '22 20:09

Andrews32