• Andry

    (@blackstar1991)


    Can you please tell me how to turn off a form if it has already been submitted once?
    I’m trying to implement it through code.

    <script>
    const wpcf7Elm =document.querySelector( '.wpcf7' );
    const sendBtn = document.querySelector('.wpcf7-submit');
    
    wpcf7Elm.addEventListener( 'wpcf7mailsent', function( event ) {
    	console.log("SEND FORM");
    	sendBtn.attr('disabled', true);
        setTimeout( function(){sendBtn.attr('disabled', false)}, 3000);
    }, false );
    </script>

    But it keeps sending the form if all required fields are filled in correctly.

    How can it fix ?

Viewing 1 replies (of 1 total)
  • Thread Starter Andry

    (@blackstar1991)

    <script>
    const wpcf7Elm =document.querySelector( '.wpcf7-form' );
    const sendBtn = document.querySelector('.wpcf7-submit');
    
    wpcf7Elm.addEventListener( 'wpcf7mailsent', function( event ) {
    	sendBtn.setAttribute("disabled", "disabled");
        setTimeout(function(){sendBtn.removeAttribute("disabled")}, 3000);
    	console.log("SEND FORM");
    }, false );
    </script>

    I tried applying this code, but it didn’t work for me. Users are still able to click and resend forms to the server

Viewing 1 replies (of 1 total)
  • The topic ‘How to disabled Submite butten for multisubmitting?’ is closed to new replies.