How can I make the page stay at the location of the submit button rather than scroll up after clicking on the submit form

  • Profile Image
    FamConference
    Asked on July 23, 2015 at 07:55 AM

    I have a relatively long form that when submitted, the page scrolls to the very top but I would like it to stay at the location of the submit form so that the person submitting the form can see the "Thank You" message rather than have the form scroll up to the very top. I am kind of a newbie to this and would really appreciate any help.

     

    If you use the link below to submit a form, please make sure that it identifies it as a test rather than a genuine submission. Please use name as 'TEST' or something similar.

     

    Thanks,

    Ben

  • Profile Image
    Kiran
    Answered on July 23, 2015 at 11:36 AM

    The redirected thank you page height is lesser than the form height and hence the webpage is adjusting it's height by pulling the footer upside. 

    Could you try embedding the form using the following iframe code to see how it works? The following iframe embed code is having a little modification to the actual generated iframe embed code.

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

    Let us know if the issue still persists. We will be happy to help.