• Resolved ahhhaweb

    (@ahhhaweb)


    I’ve tried to implement both the cf7 code from the knowledge base
    (https://wppopupmaker.com/docs/advanced/how-to-close-a-popup-when-form-is-submitted/ )

    function custom_cf7_scripts() { ?>
    <script>
    
            function _cf7_18535_on_sent_ok_() {
    	popmake-18536.trigger('popmakeSetCookie').popmake('close');
            }
    </script><?php
    
    }
    
    add_action('wp_head', 'custom_cf7_scripts', 1000);

    and in the cf7 advanced settings tab I added
    on_sent_ok: "__cf7_18535_on_sent_o

    And I also tried wrapping the cf7 submit shortcode with a class=popmake-close.

    The first effort, using code in functions.php, isn’t working. The form works and submits correctly but the popup doesn’t close. The second method using a class wrapper closes the popup but the form doesn’t submit.

    You can see the popup for the whitepaper request popup at http://www.ahhhalaw.com

    Any help you can give on implementing the close on successful submit will be greatly appreciated.

    https://ww.wp.xz.cn/plugins/popup-maker/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ahhhaweb

    (@ahhhaweb)

    Resolved – Contact Form 7 is now using wpcf7 as their element name. Working code is `
    function custom_cf7_scripts() { ?>
    <script type=”text/javascript”>
    function _wpcf7_18535_on_sent_ok_() {
    jQuery(document).ready(function () {
    jQuery(‘#popmake-18536’).popmake(‘close’);
    });

    }
    </script><?php
    }

    add_action(‘wp_head’, ‘custom_cf7_scripts’, 1000);`

    Plugin Author Daniel Iser

    (@danieliser)

    @ahhhaweb – Glad you got it worked out, but looking it over, the actual function name shouldn’t have any effect, I just named it like that in our example to try and prevent any future errors due to duplicate function names.

    You could call it my_awesome_function and then add that as the parameter in your advanced settings and it should work, they simply accept any JS function in that parameter. May have been a caching issue.

    In any case glad you got it working.

    Please take a moment to rate and review the plugin and or support.

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

The topic ‘Close on Submit with embedded CF7 Form’ is closed to new replies.