• Resolved katrinmathis

    (@katrinmathis)


    Is there a way (a setting or a JavaScript code) to hide the form when the success message and gated content are shown?

Viewing 1 replies (of 1 total)
  • Plugin Author Wyatt Kirby

    (@odisant)

    Hi @katrinmathis

    The gated content plugin does not hide the form for you, but adding Javascript to do so is pretty easy. Simply hook into the same JS event emitted by CF7 to do your hiding. It will look _something_ like this:

    
      document.addEventListener(
        "wpcf7submit",
        function (event) {
          var detail = event.detail;
          var status = detail.apiResponse.status;
    
          if (status === "mail_sent") {
            // hide the form
          }
        }
      );
    
Viewing 1 replies (of 1 total)
  • The topic ‘Hide form on success’ is closed to new replies.