• Resolved bxbdev

    (@bxbdev)


    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

    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

    (@optimizingmatters)

    hey @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

    (@bxbdev)

    This page has a conditional form on it:

    https://bxblayout06.flywheelsites.com/review/

    • This reply was modified 6 years, 11 months ago by James Huff.
    • This reply was modified 6 years, 11 months ago by bxbdev.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    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

    (@bxbdev)

    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

    (@optimizingmatters)

    Well, as per the 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.