Forum Replies Created

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

    (@medoedo)

    Update:
    The solution was to reinit form when popup open

    jQuery( document ).on( 'elementor/popup/show', () => {
            const originalElement = document.querySelector('.codedropz-upload-wrapper');
    
            if ( originalElement !== null ) {
                if ( originalElement.parentElement.nodeName !== "SPAN" && originalElement.parentElement.nodeName == "FORM" ) {
                    // Reinit Form in popup
                    $('div.wpcf7 > form').each(function () {
                        var $form = $(this);
                        wpcf7.init($form[0]);
                        if (wpcf7.cached) {
                            wpcf7.refill($form);
                        }
                    });
    
                    const clonedElement = originalElement.cloneNode(true);
                    const clonedElementPlacement = originalElement.parentElement.querySelector('span[data-name="Resume"]');
                    clonedElementPlacement.appendChild(clonedElement);
                    originalElement.parentElement.querySelector('span[data-name="Resume"] .codedropz-upload-handler').remove();
                    originalElement.remove();
                    window.initDragDrop();
                }
            }
        });
    Thread Starter medoedo

    (@medoedo)

    I modified the code a little and now it works almost fine, the only problem is that when I click on the submit button, the page reloads

    jQuery( document ).on( 'elementor/popup/show', () => {
            const originalElement = document.querySelector('.codedropz-upload-wrapper');
    
            if ( originalElement !== null ) {
                if ( originalElement.parentElement.nodeName !== "SPAN" && originalElement.parentElement.nodeName == "FORM" ) {
                    const clonedElement = originalElement.cloneNode(true);
                    const clonedElementPlacement = originalElement.parentElement.querySelector('span[data-name="Resume"]');
                    clonedElementPlacement.appendChild(clonedElement);
                    originalElement.parentElement.querySelector('span[data-name="Resume"] .codedropz-upload-handler').remove();
                    originalElement.remove();
    window.initDragDrop();
                }
            }
        } );
    • This reply was modified 11 months ago by medoedo.
Viewing 2 replies - 1 through 2 (of 2 total)