What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    Can an automatic redirection be made on our thank you page?

    Asked by slleykersxx on April 20, 2016 at 03:47 PM

    Another Doubt : Include automatic redirection after a few seconds , on the same screen below the image ?

     

     

    thank you page redirect
  • Profile Image

    Answered by Ben on April 20, 2016 at 04:25 PM

    Usually that would not be possible, but it might be possible due to the way you have used to embed the form on your website: stipesquisa.esy.es

    What I would suggest to try is the following JavaScript code:

     <script type="text/javascript">
          window.handleIFrameMessage = function(e) {
            var args = e.data.split(":");
            var iframe = document.getElementById("JotFormIFrame");
            if (!iframe)
              return;
            switch (args[0]) {
              case "scrollIntoView":
                iframe.scrollIntoView();
                break;
              case "setHeight":
                if(args[1] == 437){
              customHeight = 600;
              }else{
              customHeight = args[1];
              }
                iframe.style.height = customHeight + "px";
                break;
              case "collapseErrorPage":
                if (iframe.clientHeight > window.innerHeight) {
                  iframe.style.height = window.innerHeight + "px";
                }
                break;
              case "reloadPage":
                window.location.reload();
                break;
            }
            var isJotForm = (e.origin.indexOf("jotform") > -1) ? true : false;
            if(isJotForm && "contentWindow" in iframe && "postMessage" in iframe.contentWindow) {
              var urls = {"docurl":encodeURIComponent(document.URL),"referrer":encodeURIComponent(document.referrer)};
              iframe.contentWindow.postMessage(JSON.stringify({"type":"urls","value":urls}), "*");
            }
            var isThankyou = (e.origin.indexOf('submit') > -1) ? true:false;
            if(isThankyou) { setTimeout( function() { window.location.replace('VALID LINK TO REDIRECT TO'); } , 3000); }
          };
          if (window.addEventListener) {
            window.addEventListener("message", handleIFrameMessage, false);
          } else if (window.attachEvent) {
            window.attachEvent("onmessage", handleIFrameMessage);
          }
          if(window.location.href && window.location.href.indexOf("?") > -1) {
            var ifr = document.getElementById("JotFormIFrame");
            var get = window.location.href.substr(window.location.href.indexOf("?") + 1);
            if(ifr && get.length > 0) {
              var src = ifr.src;
              src = src.indexOf("?") > -1 ? src + "&" + get : src  + "?" + get;
              ifr.src = src;
            }
          }
          </script>

    - This code should go instead of the current Javascript code - the one right under the iframe code on your page.

    I had made it check if it is the thank you page and then if it is, to redirect after 3 seconds.

    It is however important to change VALID LINK TO REDIRECT TO above to the actual link to avoid any issues and the reason why I had set it to 3 seconds is to allow the thank you page to load, otherwise it would do it too quickly.

    Please do test it out and let us know how it goes.

  • Profile Image

    Answered by slleykersxx on April 20, 2016 at 05:48 PM

    Everything functioning normally .. Thank you very much the same . 

     

    I thank you

  • Profile Image
    JotForm Support

    Answered by liyam on April 20, 2016 at 08:16 PM

    On behalf of my colleague, you are welcome :)

    If you have other questions or concerns, please do let us know.

    Thanks and warm regards.