• Resolved electromystyle

    (@electromystyle)


    Hello, I have identified a small problem in your plugin. For example, I create a form for a popup window and add it to my post via a button. On the same page of the sidebar post, I have a similar form. It doesn’t matter if the form IDs match or they are different. At first, the form in the sidebar works fine, it outputs validation errors in a single instance. But after I click the display button in the post, <span class=”wpcf7-spinner”/> elements and other validation elements are added to the form in the sidebar. With each new click on the button, new elements are added to the form in the sidebar, which leads to duplication of validation elements. I have analyzed your code and this problem is in the file frontend.js

    // For CF7 5.4 and after
    if ( typeof wpcf7.init === 'function' ) {
        document.querySelectorAll(".wpcf7 > form").forEach(function (e) {
            return wpcf7.init(e);
        });
    }

    It turns out that each form on the page is initialized again and again, and should be initialized only in the popup window.
    To fix this problem , it is enough to specify a class .wpb-pcf-form-style-true .wpcf7 > form or something like that

    You can reproduce this problem on the page I attached

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘A small initialization bug’ is closed to new replies.