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.

Compatibility w/ Multiple Content Blocks Plugin

  1. ewarnke
    Member

    A friend gave me a copy of GF to test and I fully intend on paying for it... if I can actually get it to work with my WP installation. I have the Multiple Content Blocks plugin activated and it's an essential part of our website.

    Currently any forms that use conditional logic do not display if they are placed in the_block() sections of that plugin. Anything that's placed in the normal the_content() in WP display just fine.

    Is there a work around? MCB is a very popular plugin and I don't know of an alternative that's as capable.

    Posted 14 years ago on Wednesday December 22, 2010 | Permalink
  2. The issue is how the shortcode enqueues the necessary Javascript for the conditional logic to work. It won't automatically do it when using the MCB plugin because of how WordPress and the MBC plugin works.

    The workaround for this is to add code to your theme to manually enqueue the necessary Javascript.

    For Gravity Forms v1.4.5 and earlier you would add the necessary code to enqueue the JS and CSS to your themes functions.php file. It would look like this:

    if(!is_admin()){
    wp_enqueue_script("gforms_ui_datepicker", WP_PLUGIN_URL . "/gravityforms/js/jquery-ui/ui.datepicker.js", array("jquery"), "1.3.9", true);
    
    wp_enqueue_script("gforms_datepicker", WP_PLUGIN_URL . "/gravityforms/js/datepicker.js", array("gforms_ui_datepicker"), "1.3.9", true);
    
    wp_enqueue_script("gforms_conditional_logic_lib", WP_PLUGIN_URL . "/gravityforms/js/conditional_logic.js", array("gforms_ui_datepicker"), "1.3.9", true);
    
    wp_enqueue_style("gforms_css", WP_PLUGIN_URL . "/gravityforms/css/forms.css");
    }

    If you are running Gravity Forms v1.5 then the code may be slightly different, we've implemented a function in the latest release that you would call and it will then automatically enqueue the necessary JS for the form you are displaying. I can provide that if necessary.

    Posted 14 years ago on Wednesday December 22, 2010 | Permalink
  3. ewarnke
    Member

    Works, cheers :)

    Posted 14 years ago on Wednesday December 22, 2010 | Permalink
  4. Ron
    Member

    Carl can you supply the code for GF 1.5 please? Thank you.

    Posted 14 years ago on Thursday December 23, 2010 | Permalink
  5. Gravity Forms v1.5 introduces a function call you can make that will enqueue the necessary JS for a given form. You need to be running the latest release candidate.

    gravity_form_enqueue_scripts(101, true|false);

    The first parameter is the form id of the form you want to enqueue the scripts for, the second parameter is for if you want to use AJAX or not and it needs to be set to either true or false.

    Posted 14 years ago on Thursday December 23, 2010 | Permalink