PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Error: gf_apply_rules is not defined

  1. I am usually pretty good at troubleshooting these things myself. Right now I just don't have the time.

    I am getting a javascript error and cannot figure out why. I think it has something to do with the conditional statements I am trying to use in my form I removed the conditional and it still doesn't work. I have other forms on here that seem to be working. No idea why this one is not.

    I am using GF version 1.4.5 (just downloaded it tonight.)

    Error: gf_apply_rules is not defined
    Source File: http://eventespresso.com/update-request/
    Line: 255

    Here is a link to my HTML code:
    http://pastebin.com/7g853eE4

    Here is the link to the broken page:
    http://eventespresso.com/update-request/

    Here is a link to a working page:
    http://eventespresso.com/contact/

    Posted 13 years ago on Wednesday December 8, 2010 | Permalink
  2. I forgot to mention that I duplicated this form from a similar form. Not sure if that helps.

    The old form works, this one does not.

    Posted 13 years ago on Wednesday December 8, 2010 | Permalink
  3. Update:

    It is the "Enable Conditional Logic" that is causing the problems. When I remove that it seems to work just.

    In the process of testing I found that the Mailchimp and Google Analyticator plugins were causing javascript errors. Which was probably breaking the form. I updated both of these plugins then tested again and everything worked.

    Then I updated my WordPress install to 3.0.2 and everything stopped working again.

    I can do without the "Enable Conditional Logic" for now.

    Posted 13 years ago on Wednesday December 8, 2010 | Permalink
  4. Which "Enable Conditional Logic" was causing this? On a specific field or on the submit button in form settings?

    Can you post a link to the form export XML file so we can import it as it was and test it on our end? Was this happening in a specific web browser (and version)?

    Posted 13 years ago on Wednesday December 8, 2010 | Permalink
  5. BillFishkin
    Member

    Having this same problem, also using conditional logic. I am noticing that no Gravity Form js files are being referenced. wp_head() and wp_footer() are in their appropriate locations within the theme.

    Posted 13 years ago on Tuesday March 8, 2011 | Permalink
  6. BillFishkin
    Member

    After comparing my page with the preview page, I was correct

    ../wp-content/plugins/gravityforms/js/conditional_logic.js?ver=1.4.5

    ...As well as all the other required JS files of my form such as:

    ../wp-content/plugins/gravityforms/js/jquery-ui/ui.datepicker.js?ver=1.4.5
    ../wp-content/plugins/gravityforms/js/datepicker.js?ver=1.4.5

    Are not being hooked into the wp_head() function, therefor, the required files are not being accessed by the form and throwing an error. Has there been a fix for this?

    Posted 13 years ago on Tuesday March 8, 2011 | Permalink
  7. @BillFishkin It depends on how you have implemented your form. Scripts only get enqueued when using the shortcode and a traditional WordPress loop.

    If you are using a function call to display the form you have to manually enqueue the necessary scripts.

    If you are using a theme that has a non-standard display method of showing pages (ex. a theme that shows multiple pages on a single page) then again, you will have to manually enqueue the necessary scripts.

    So if the scripts aren't being enqueued it's most likely because of the implementation. Enqueue only works in certain situations. 98% of the time it is going to work, but if your theme isn't developed in standard fashion or you are using the function call it is not going to do it automatically.

    Documentation for enqueuing the scripts is on the Embedding Forms page of the Documentation and there is a new function call in the upcoming 1.5 release that will make it easier to enqueue from functions.php via a single function call.

    Posted 13 years ago on Tuesday March 8, 2011 | Permalink
  8. I have the same problem:

    I have a standard loop,
    am embedding the form via the shortcode,
    am loading jquery 1.4.2 in the header before wp_head,
    I have a call to wp_footer in my footer,
    am still getting this error.

    The page is located at http://rno1.com/test
    the password for the page is Gravity . Sorry for the janky styling.

    Posted 13 years ago on Tuesday May 10, 2011 | Permalink
  9. @jacobdubail Can you double check that password? It isn't allowing me to view that page.

    Posted 13 years ago on Wednesday May 11, 2011 | Permalink
  10. Should work. Here's a screenshot: http://dl.dropbox.com/u/1210327/Gravity.png

    Thanks again for all of your help!

    Posted 13 years ago on Wednesday May 11, 2011 | Permalink
  11. Does your header.php file have the wp_head() function call and your footer.php file have the wp_footer() function call? Because the javascript isn't being enqueued. I also see you are using a plugin for minification, that could be also causing a problem.

    You are going to have to test for theme and plugin issues. I'm guessing either your theme has something wrong or another plugin is causing the issue.

    Follow the instructions here:

    http://www.gravityhelp.com/documentation/page/Testing_for_a_Theme/Plugin_Conflict

    Posted 13 years ago on Wednesday May 11, 2011 | Permalink
  12. Yeah, we definitely have wp_head and wp_footer in the proper places.

    I'll try disabling a few non-essential plugins at a time. I'll also follow those instructions. I'll report back shortly.

    Thanks again for your help!

    -J

    Posted 13 years ago on Wednesday May 11, 2011 | Permalink
  13. Ha. Turns out it's the WP Minify plugin. Lame. Guess I'll have to minify them myself. Bummer.

    Seems to be working now. Any clue as to why WP Minify would conflict?

    EDIT: Excluded the gravity forms scripts from the WP Minify plugin and all is well.

    Posted 13 years ago on Wednesday May 11, 2011 | Permalink
  14. We will check out the WP Minify plugin and see if we can recreate this issue and see if there is anything we can do on our end to make it play nice. No guarantees but we will take a look.

    Posted 13 years ago on Thursday May 12, 2011 | Permalink

This topic has been resolved and has been closed to new replies.