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

  • Profile Image
    starlightincorp
    Asked 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
    Welvin
    Answered on December 11, 2013 at 10:08 AM

    Hi,

    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.

    Thanks