Thank you message: Make page automatically scroll to the top after submitting

  • koob199
    Asked on April 28, 2014 at 6:09 PM
    My form is a bit long so when my users get to the "submit" button the page has been scrolled down. When they click "submit" and the form completes uploading, my thank you message appears, however it appears at the top of the page, so they can't see it... and they question if it submitted properly. Can I have the page automatically scroll to the top after submitting?
  • Jeanette JotForm Support
    Replied on April 28, 2014 at 6:32 PM

    Looks like your iFrame code needs to be updated, so far it's missing the code in bold:

    So, please replace the current code for the one in green and yellow. If the problem persist, you should get rid of the yellow part

    <iframe id="JotFormIFrame" onDISABLEDload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotform.us/form/40068827256156" frameborder="0" style="width:100%; height:1244px; 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;}};if (window.addEventListener) {window.addEventListener("message", handleIFrameMessage, false);} else if (window.attachEvent) {window.attachEvent("onmessage", handleIFrameMessage);}</script>

  • Jeanette JotForm Support
    Replied on April 28, 2014 at 6:34 PM

     

    Actually, this is the right code:

    <iframe id="JotFormIFrame" onDISABLEDload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotform.us/form/40068827256156" frameborder="0" style="width:100%;  height:9855px; 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;}};if (window.addEventListener) {window.addEventListener("message", handleIFrameMessage, false);} else if (window.attachEvent) {window.attachEvent("onmessage", handleIFrameMessage);}</script>

  • koob199
    Replied on April 29, 2014 at 1:49 PM

    Thank you but I believe I read on your website that when using with Squarespace I was supposed to actually delete that section in bold so it worked properly. Is that not true? I will try to put that back in and test.

    UPDATE: I tried the update and it worked for my one form. Is the code you gave me just the "I Frame" code copied as is? Maybe squarespace fixed their issue.

     

    Thanks