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

    How to stop parent window from scrolling when the form loads

    Asked by easternairproducts on September 13, 2013 at 07:11 PM
  • Profile Image

    Answered by easternairproducts on September 13, 2013 at 07:14 PM

    I have a form embedded in a long, scrolling web page. When I click on the button that brings the form up in a Fancybox, it scrolls the main page to the top behind the scenes. I don't want the page to scroll back. I see a snippet of code through Firebug that reads: onload="window.parent.scrollTo(0,0)

    This appears to be the culprit. Is there a way to deactivate that piece of code?


  • Profile Image
    JotForm Support

    Answered by Tasha on September 13, 2013 at 08:00 PM

    Hi,

    Can you send us the link for the page where the form is embedded so that we can have a look at it?

    Thanks!

  • Profile Image

    Answered by jboron on September 13, 2013 at 08:19 PM
    Sure -- thanks.
    http://appliedalchemy.com/
    If you click on the picture of the *Heatless Oilfield Packaged Desiccant
    Dryer* (for example) and then click on the red *Request a Quote* button,
    you'll see what happens.
    I have tried playing with the*onload="window.parent.scrollTo(0,0)"*
    code, but I don't know enough about it to make changes effectively. I
    did try substituting (0,ht-200) and it didn't move, but it displayed the
    code and not the form.
    Any suggestions as to where I can look to find out more about the
    scrollTo functionality?
    Thank you!
    Bill
    The Coming Wave--Web Design and Marketing for the Small Business
    William C. Even, Owner
    The Coming Wave, LLC
    P. O. Box 554
    Orchard Park, NY 14127
    716.462.5171
    Bill@TheComingWave.com
    www.TheComingWave.com
    www.TheComingWave.biz (for hosting and
    domain registration)
  • Profile Image
    JotForm Support

    Answered by jonathan on September 13, 2013 at 08:44 PM

    Hi Bill,

    Please try to re-embed the quote form on your web page here http://appliedalchemy.com/RFQ-HOF.htm  using its iFrame code (use this guide: Getting-the-Form-iFrame-Code)

    The iframe code should be similar to this

     

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//www.jotform.com/form/32396863412155" frameborder="0" style="width:100%; height:1256px; 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>

     

    You can exclude the codes that were hightliged in red.

    If you noticed in the iframe code, the height of the frame is also specified. This is the height of the form. You can adjust this if the output form is cut-off.

    Hope this help. Inform us if you need further assistance.

    Thanks.

  • Profile Image

    Answered by jboron on September 13, 2013 at 11:30 PM
    You rock!
    Thank you for your help.
    Bill
    The Coming Wave--Web Design and Marketing for the Small Business
    William C. Even, Owner
    The Coming Wave, LLC
    P. O. Box 554
    Orchard Park, NY 14127
    716.462.5171
    Bill@TheComingWave.com
    www.TheComingWave.com
    www.TheComingWave.biz (for hosting and
    domain registration)