Title: Conditional Gravity Form Not Loading
Last modified: December 15, 2017

---

# Conditional Gravity Form Not Loading

 *  Resolved [bxbdev](https://wordpress.org/support/users/bxbdev/)
 * (@bxbdev)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/conditional-gravity-form-not-loading/)
 * I am using your plugin and it has been working great!
 * My only issue is that Gravity Forms that use conditional logic do not show up.
   However, forms without conditional logic work fine.
 * From what I understand, forms using conditional logic hide all of the fields 
   and then use JS to display the initial set of fields. Obviously by loading the
   JS in the footer (as I am currently doing) this breaks the functionality.
 * But if I view the form’s page by adding `?ao_noptimize=1` to the end of the URL(
   i.e. domain.com/contact/?ao_noptimize=1) the form loads properly.
 * I know that there are some Autoptimize snippets here: [https://github.com/futtta/autoptimize/blob/master/autoptimize_helper.php_example](https://github.com/futtta/autoptimize/blob/master/autoptimize_helper.php_example)
 * Would using the following snippet be the same as adding the querystring above?
 *     ```
       /* autoptimize_filter_noptimize: stop autoptimize from optimizing, e.g. based on URL as in example
   
       @return: boolean, true or false */
       // add_filter('autoptimize_filter_noptimize','my_ao_noptimize',10,0);
       function my_ao_noptimize() {
       	if (strpos($_SERVER['REQUEST_URI'],'no-autoptimize-now')!==false) {
       		return true;
       	} else {
       		return false;
       	}
       }
       ```
   
 * If so, my question is how do I define the page(s) I want to use in that snippet
   to avoid using Autoptimize?
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/conditional-gravity-form-not-loading/#post-9786953)
 * hey [@bxbdev](https://wordpress.org/support/users/bxbdev/);
    if you can provide
   me with a URL to a page with such a conditional form, I can have a quick look&
   tell you what to add to the “exclude from JS optimization”-field?
 * frank
 *  Thread Starter [bxbdev](https://wordpress.org/support/users/bxbdev/)
 * (@bxbdev)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/conditional-gravity-form-not-loading/#post-9786974)
 * This page has a conditional form on it:
 * [https://bxblayout06.flywheelsites.com/review/](https://bxblayout06.flywheelsites.com/review/)
    -  This reply was modified 8 years, 5 months ago by [James Huff](https://wordpress.org/support/users/macmanx/).
    -  This reply was modified 8 years, 5 months ago by [bxbdev](https://wordpress.org/support/users/bxbdev/).
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [8 years, 5 months ago](https://wordpress.org/support/topic/conditional-gravity-form-not-loading/#post-9790762)
 * well, had a quick look and on the developer console i see this JS error;
 * > ReferenceError: jQuery is not defined
 * As per the FAQ this can easily be fixed by (re-)adding js/jquery/jquery.js to
   the comma-separated JS optimization exclusion list. After that try again and 
   if it still doesn’t work start by checking the console for relevant errors. I’ll
   be happy to assist if needed.
 * frank
 *  Thread Starter [bxbdev](https://wordpress.org/support/users/bxbdev/)
 * (@bxbdev)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/conditional-gravity-form-not-loading/#post-9882911)
 * Alright, so I turned off “Optimize JavaScript Code?” completely and the conditional
   Gravity Form loads and works properly.
 * If I turn “Optimize JavaScript Code?” back on and have the following exclusions:
 * seal.js, js/jquery/jquery.js
 * the form no longer loads. This is the state the site is currently set to.
 * I have also cleared cache with no luck.
 *  Plugin Author [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * (@optimizingmatters)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/conditional-gravity-form-not-loading/#post-9882970)
 * Well, as per [the FAQ](https://wordpress.org/plugins/autoptimize/faq) (it is 
   a great resource, really, have a look, you’d be surprised) JS errors on the developer
   console can be of great help and I see:
 * > TypeError: jQuery(…).textareaCount is not a function review:4:6213
   >  ReferenceError:
   > renderRecaptcha is not defined review:11:5
 * And when looking at your un-optimized HTML source I can fine:
 * `<script type='text/javascript' src='https://bxblayout06.flywheelsites.com/wp-
   content/plugins/gravityforms/js/jquery.textareaCounter.plugin.min.js'></script
   >`
 * and when looking around I can see the `renderRecaptcha` function is defined in/
   wp-content/plugins/gravityforms/js/gravityforms.min.js
 * So why don’t you try to add `jquery.textareaCounter.plugin.min.js, gravityforms.
   min.js` to the comma-separated JS optmization exclusion list? 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Conditional Gravity Form Not Loading’ is closed to new replies.

 * ![](https://ps.w.org/autoptimize/assets/icon-256X256.png?rev=2211608)
 * [Autoptimize](https://wordpress.org/plugins/autoptimize/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/autoptimize/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/autoptimize/)
 * [Active Topics](https://wordpress.org/support/plugin/autoptimize/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/autoptimize/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/autoptimize/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Optimizing Matters](https://wordpress.org/support/users/optimizingmatters/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/conditional-gravity-form-not-loading/#post-9882970)
 * Status: resolved