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

    iFrame embed code changes height value

    Asked by WISSF on May 13, 2015 at 02:07 PM

    Using iFrame embedding.

    I've added CSS to the enclosing box in Visual Composer... and I've added custom CSS in Jotform to make the height right. The iFrame code says 700px... but when the page renders the height reverts to 280px for some reason. WHY?

    Page URL:
    http://wissf.org/demo-may-13-form-example-2/

    Screenshot
    height JotForm iframe code and
  • Profile Image
    JotForm Support

    Answered by Charlie on May 13, 2015 at 02:57 PM

    It seems like the "onload" function causes the iFrame to revert or inherit other height field.

    Can you try this, copy your iFrame embed code here: http://www.jotform.com/help/148-Getting-the-Form-iFrame-Code.

    In my case, this is how I will edit it:

    Before:

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

    After:

    <iframe id="JotFormIFrame" onload="window.parent.scrollTo(0,0)" allowtransparency="true" src="//form.jotformpro.com/form/50885628517971" frameborder="0" style="width:100%; height:700px !important; border:none;" scrolling="no"></iframe>

     

    I've removed the <script> code that was included on it, then set the height inside the iFrame code to 700px and added "!important" tag. Also, please do remove the custom CSS code that you added inside the form to avoid conflicts.

    Please do let us know if this works.

    Thank you.