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.

When enable conditional logic the form becomes hidden

  1. Hi

    I have an odd issue. I have a contact form on this test site http://sitefix.dk/temp/kontakt/.

    I would like to use a drop down menu and based on the selection a new dropdown should apear. However, when I select enable conditional logic on the second drop down, the entire form is hidden with inline css with display:none.

    What am I doing wrong?

    Thanks
    Vayu

    Posted 9 years ago on Wednesday April 20, 2011 | Permalink
  2. I don't see the conditional logic script being loaded in your page. How are you embedding your form in the page.. via the shortcode in the page editor or via the function call in the page template itself.

    When using a Gravity Form in a sidebar widget or embedding it anywhere using the function call, you need to manually enqueue the scripts and CSS by placing a short script block in your theme's functions.php file.

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

    Without this, the conditional logic scripts, datepicker script, form CSS and other elements needed for the full form functionality aren't loaded.

    You can find more information at the URL below

    http://www.gravityhelp.com/documentation/page/Embedding_A_Form

    Also, be sure to check your theme has the wp_head() function in the header file and the wp_footer() function in the footer file. Both are necessary to load the form scripts & CSS.

    Posted 9 years ago on Wednesday April 20, 2011 | Permalink
  3. Hi Kevin.

    Thanks for your quick support.

    Here is how I embedded the form:

    <?php gravity_form(2, false, false, false, null, true); ?>
    <?php gravity_form_enqueue_scripts(2, true); ?>

    I thought the gravity_form_enqueue_scripts function fixed all that stuff?

    Posted 9 years ago on Wednesday April 20, 2011 | Permalink
  4. Hi Vayu,

    You are correct, gravity_form_enqueue_scripts() is the new preferred way of loading the scripts; however, the old manual method will still work.

    Try adding <?php gravity_form_enqueue_scripts(); ?> above the wp_head() function in your header.php file, if the sidebar form will be on most pages.

    Posted 9 years ago on Wednesday April 20, 2011 | Permalink
  5. Hi David.

    I have now testet by placing the gravity_form_enqueue_scripts(2, true); above wp_head(); and that worked great.

    Thanks for helping! :-)
    Vayu

    Posted 9 years ago on Tuesday April 26, 2011 | Permalink
  6. Vayu,

    My apologies. I completely forgot about the new enqueue method there.. it's much easier. Thanks to David for setting the old man straight. I'm glad everything's working for you now.

    Posted 9 years ago on Tuesday April 26, 2011 | Permalink

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