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

Add "Form Loading" status while iFrame loads


  1. erikandre
    Member

    Is it possible to add some kind of "Please be patient while Form Loads" status while an iFrame is loading on a page. I've seen some occasions where the form loads very fast with some clients and other occasions where the form takes several seconds to load. I've had to add a static text to every form that says "Form may take a few seconds to load" just to compensate. Would really appreciate it if this were possible.

    Posted 15 years ago #
  2. yuniar

    Is it possible for you to use the Advanced Form Code? It loads faster than the iframe.

    However, if you can't use the Advance Form Code, yes it is possible to add some kind of loading text message while the iframe is loading.

    I've put up some simple sample, check it here:
    http://www.appnitro.com/demo/sample_preload.html

    Check the HTML source of that page to see how I did it.
    Or just see it here:
    http://mf.pastebin.com/f3c863aa4

    So all you need to do is to add some element which holds the preload message. In this sample, I added this before the iframe:

    <h1 id="loader" style="position: absolute;top: 100px">Form loading. Please wait...</h1>

    Then insert this javascript code into your <head></head> section:

    <script type="text/javascript">
    function hideProgress(){
            document.getElementById('loader').style.display = 'none';
    }
    </script>

    And finally, add an onLoad event to your iframe:

    onload="hideProgress()"

    So what it does, the loading text will be displayed first, then as soon as the iframe finished loading, the onLoad event is executed and hideProgess() function being called, which would hide the loader text.


    MachForm Founder

    Posted 15 years ago #
  3. erikandre
    Member

    Brilliant. That is exactly what I'm talking about.

    Perhaps you could add that in the next version as a standard feature.. even have an option in the admin panel to display it for embedded code.

    Posted 15 years ago #

RSS feed for this topic

Reply