Open popup on form submit

Using Forminator form in the homepage, and trying to use Hustle to load the popup once the Form is submitted.

Tried using the “Click” popup trigger option in Hustle, which does display the popup, but it isn’t allowing to submit the form.

Looking for a workaround regrading this, please advise, if any quick custom code would help regarding this, or not.

  • Konstantinos Xenos
    • Rubber Duck Debugger

    Hi Manjeet Singh ,

    Could you try by adding this code in your functions.php ( preferably your child themes ). The only code that would require altering is the “forminator-module-381” to change the number 381 into the ID of your forminator form and the “module_id_1” to change the number 1 into the ID of the popup. Both values can be found while editing the Form and the Popup on your Admin and if you look at the URL while editing you’ll see a &id=NUMBER .

    I’ve added the correct numbers as far as I can see from your current page setup at the moment but they might need to be changed in the future.

    add_action( 'wp_footer', 'my_custom_popup_trigger' );
    function my_custom_popup_trigger() {
    ob_start();
    ?>
    <script>
    ( function( $ ) {
    $( document ).ready( function() {
    $( '#forminator-module-381 #forminator-submit' ).on( 'click', function( e ) {
    setTimeout( function() {
    if ( ! $( '.forminator-label--validation' ).length ) {
    $( '.module_id_1' ).addClass( 'wph-modal-active' );
    $( '.module_id_1 div.hustle-modal' ).addClass( 'hustle-modal-static' );
    }
    }, 500 );
    });

    $( '.module_id_1' ).prepend( '<div class="wph-modal-mask wpmudev-modal-mask "></div>' );
    });
    } ( jQuery ) );
    </script>
    <?php
    $scripts = ob_get_clean();
    echo $scripts;
    }

    Regards,

    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.