This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

IFrame Height


  1. davidbeirne
    Member

    Hi,

    I must say this is a Great Web-App!!

    Question:
    When you design a form and embed it on a website using the Iframe, the height is set for the iframe in the Code. but later if you do any modifications to the forms e.g. add another field and the form height is larger than when you first embed the form, the information at the bottom of the form becomes hidden (as the form height is still at the old height). Is there an automatic way to adjust the form height based on the fields added? Maybe add in next version!!.

    Posted 17 years ago #
  2. yuniar

    Hi David,

    At this moment, there is no automatic way to do this yet, sorry.
    An automatic way would be awesome, but I'm still figuring out the best way to do this.

    Thanks for the suggestion.


    MachForm Founder

    Posted 17 years ago #
  3. juehec
    Member

    Hi David,

    i have a solution for this problem. At first add

    id="machform"

    on your IFRAME

    then add the following code in the file includes/view-functions.php
    at the function display_form() and display_success() after
    the Line <script type="text/javascript" src="js/calendar.js"></script>

    <script type="text/javascript">;
    	function resizeIframe() {
    
    		// Must launched on the body onload event handler for IE
    		// Use document.documentElement if you are in Compat mode
    		i = parent.document.getElementById('machform')
    		iHeight = document.body.scrollHeight
    		i.style.height = iHeight + 5 + "px"
    	}
    </script>;


    and then change the line
    <body id="main_body" {$embed_class}>
    to
    <body onload="resizeIframe()" id="main_body" {$embed_class}>;

    On my Site this works well

    Kind Regards
    Juergen

    Posted 17 years ago #
  4. yuniar

    Hey Juergen, thanks for sharing this!
    Very useful. I think most people would found this valuable.


    MachForm Founder

    Posted 17 years ago #
  5. islanddesign
    Member

    Hi Juhec,

    Thank you very much for this code! I have tried it on FF & Safari for Mac and it works great. But when I tried it on IE6 & FF for PC, it doesn't work. Did you run into that problem as well? Would you be able to provide a solution?

    I would greatly appreciate your help on this. I know FF is very strict when it comes to JavaScript so, who knows!

    Thanks in Advance,
    IslandDesign

    Posted 16 years ago #

RSS feed for this topic

Reply