Support » Plugin: Contact Form 7 - Conditional Fields » Conditionals does not work at all

  • Resolved xenoncz

    (@xenoncz)


    Hello,
    any conditional logic does not work.

    I even deleted whole contact forms and simply copied simple examples from:
    https://conditional-fields-cf7.bdwm.be/clear_on_hide/

    And not even single one is working. Groups are not showing / hiding.

    Why?

    Simple form:

    
    [checkbox check-agree "omfg"]
    
    [group group_2 clear_on_hide]
      <p>Group 2</p>
      
    [/group]

    Conditional:
    show [group_2] if [check-agree] equals "omfg"

    Group 2 should appear when checkbox is checked….and it does not work

    // latest version of wordpres, latest version of all contact form plugins, php 7

    • This topic was modified 1 year ago by xenoncz.
    • This topic was modified 1 year ago by xenoncz.
Viewing 9 replies - 1 through 9 (of 9 total)
  • xenoncz

    (@xenoncz)

    I have really no idea why the needed CF7 scripts are not passed to wp_footer()

    I had to manually add them to the footer using switching to other theme, get the output and then directly copy it to another theme.

    • This reply was modified 1 year ago by xenoncz.
    Plugin Author Jules Colle

    (@jules-colle)

    Sounds like there’s a javascript error, probably caused by your theme or another plugin. You have a link?

    xenoncz

    (@xenoncz)

    @jules-colle I have firstly tried the thing with disabling / enabling all the plugins but did not have really any impact.

    Then I was looking for manual includes of jQueries and other scripts which could possibly mess this up. Also no impact (have the same constelation of scripts and it works with them)

    Only thing which I did I copied the footers from my theme and then TwentyTwenty theme and compared them.

    I saw immediatelly in the wp_footer() output the 4-5 things from CPF are not there.

    To be precise those lines:

    
    <script>
    var wpcf7 = {"apiSettings":{"root":"http:\/\/localhost\/conference\/wp-json\/contact-form-7\/v1","namespace":"contact-form-7\/v1"}};
    </script>
    <script src='http://localhost/conference/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=5.1.6'></script>
    <script src='http://localhost/conference/wp-includes/js/jquery/jquery.form.min.js?ver=4.2.1'></script>
    <script src='http://localhost/conference/wp-content/plugins/bootstrap-for-contact-form-7/assets/dist/js/scripts.min.js?ver=1.4.5'></script>
    <script>
    var wpcf7cf_global_settings = {"ajaxurl":"http:\/\/localhost\/conference\/wp-admin\/admin-ajax.php"};
    </script>
    <script src='http://localhost/conference/wp-content/plugins/cf7-conditional-fields/js/scripts.js?ver=1.7.9'></script>

    Omitted the rest, grabbed only following and it works:

    
    <script src='http://localhost/conference/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=5.1.6'></script>
    
    <script src='http://localhost/conference/wp-content/plugins/cf7-conditional-fields/js/scripts.js?ver=1.7.9'></script>
    
    • This reply was modified 1 year ago by xenoncz.
    • This reply was modified 1 year ago by xenoncz.
    Plugin Author Jules Colle

    (@jules-colle)

    I have really no idea why the needed CF7 scripts are not passed to wp_footer()

    I had to manually add them to the footer using switching to other theme, get the output and then directly copy it to another theme.

    Well, this sounds like a problem with caching. Are you using any caching / optimization or minify plugins? They often include an option to clear your cache. (always recommended after installing/updating a plugin)

    Plugin Author Jules Colle

    (@jules-colle)

    Or might also be caching on a higher level (hosting / browser)

    xenoncz

    (@xenoncz)

    @jules-colle
    No caching at all.
    Well I will quickly go through the WP settings again, but for plugins I am sure.

    xenoncz

    (@xenoncz)

    @jules-colle Would seem so, but switching though the themes is outputing the wp_footer() immediatelly.

    I will see how it will look like on the hosting. So far this is on localhost.
    Anyway thanks for brainstorm

    Plugin Author Jules Colle

    (@jules-colle)

    That’s pretty weird… But if I understand correctly: everything works on twenty-themes? My guess would still be that you are not calling the wp_footer() function correctly. You could probably check this by quickly modifying the core wp_footer() function and add something like die('WP FOOTER GOT CALLED'); to see if the function is triggered at all.

    Plugin Author Jules Colle

    (@jules-colle)

    You probably already know this, but I just want to get the obvious out of the way first. The best place to call wp_footer is right before the closing body tag in your theme’s footer.php file, like this:

      <?php wp_footer(); ?>
      </body>
    </html>

    reference: https://codex.wordpress.org/Function_Reference/wp_footer

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Conditionals does not work at all’ is closed to new replies.