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

    The size of the form is wrong when I use iframe, how do I get it to auto adjust?

    Asked by starlightincorp on December 11, 2013 at 06:11 AM

    When I embed the form using the sorce code there is no problems and the height of the form will auto adjust with each different page on the form. 

    The problem I have is when I use Iframe to code thats generated is below:


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


    I can change the height to a fixed amount but how can I get it to auto adjust? 

  • Profile Image
    JotForm Support

    Answered by Welvin on December 11, 2013 at 10:08 AM


    iFrame codes have a fixed height value so I don't that you can auto adjust the size. Since you are using Multi Page form, I would suggest leveling each page so each should contain the same number of fields. This would eliminate extra spaces at the bottom.

    Otherwise, I would suggest the Javascript Method.