Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Perfect! everything working as expected.
    Thank you for the fast resolution of the issue.

    Hi, I think it is not turnstile issue. In “contact-form-7.php” you have the this code:
    <script>
            document.addEventListener(“DOMContentLoaded”,function(){
                document.querySelectorAll(‘.wpcf7-form’).forEach(function(e){
                    e.addEventListener(‘submit’,function(){
                        if(document.getElementById(‘cf-turnstile-cf7-<?php echo $id; ?>’)){
                            setTimeout(function(){
                                turnstile.render(‘#cf-turnstile-cf7-<?php echo $id; ?>’);
                            },4000)}
                    })
                })
            });</script>

    This script renders a new widget each time the submit button is pressed, but there is no removal of the previous widget.

    In the same code you can remove the previous widget before rendering a new one. For example with:
    document.getElementById(‘cf-turnstile-cf7-<?php echo $id; ?>’).innerHTML = ”;

    There could be a better way, but this one is working.

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