Thank you message is not being displayed in embedded form.

  • Profile Image
    soulrider
    Asked on March 14, 2016 at 10:39 PM
    ALSO, when I hit the submit button, the confirmation of success is at the top of the form, but all the user sees is a blank screen, where the button was. Is it possible to have the message lower on the form so they see it without having to scroll up?
  • Profile Image
    Kevin_G
    Answered on March 14, 2016 at 11:27 PM

    Is this the same that you are seeing in your end? 

    I have added this line of code to the iFrame code, that is the embed method that you are using: onload="self.scrollTo(0,0)". 

    This is the updated code, try embedding your form using this code: 

    <iframe

          onload="self.scrollTo(0,0)"

          id="JotFormIFrame"

          allowtransparency="true"

          src="https://form.jotform.com/60737868392167"

          frameborder="0"

          style="width:100%;

          height:539px;

          border:none;"

          scrolling="no">

        </iframe>

        <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":

                iframe.style.height = args[1] + "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}), "*");

            }

          };

          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>

     

    Hope this helps.