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

Auto expanding iframe - DETAILS INSIDE


  1. markritchie
    Member

    Hey everyone,

    I thought I would share some javascript I found that will automatically expand the iframes that we currently use to embed forms.

    NOTE: This script will ONLY work if you have 1 domain name. (You could of course have more then 1 domain name but the javascript will only work for one of them)

    Visit http://www.dynamicdrive.com/dynamicindex17/iframessi2.htm

    iframes will automatically expand the full view of the form (for example if you hit the submit button the errors appear on the form but then in many cases parts of the form are no longer visible if you have scrollbars set to no)

    Enjoy,

    Mark

    Posted 16 years ago #
  2. yuniar

    Mark,

    Thanks again for sharing this!
    I'm changing this post status into sticky so that everyone could find it easily.


    MachForm Founder

    Posted 16 years ago #
  3. markritchie
    Member

    No problem at all yuniar. As per your reply in my other post, if you have more than one domain name pointing to your site then replace your domain name in the iframe code that machform generates with this code:

    <?php echo $_SERVER['HTTP_HOST']; ?>

    Example: Note that you still must have the http:// before the changed code or it will not work.

    <iframe id="myframe" height="570"
    allowTransparency="true" frameborder="0" scrolling="no" style="width:95%;border:none;"
    src="http://<?php echo $_SERVER['HTTP_HOST']; ?>/forms/embed.php?id=2"
    title="General Contact Form">
    <a href="http://<?php echo $_SERVER['HTTP_HOST']; ?>/forms/view.php?id=2" title="General Contact Form">General Contact Form</a>
    </iframe>

    Enjoy,

    Mark

    Posted 16 years ago #
  4. markritchie
    Member

    Hmmm.. I wonder why my code didn't paste correctly. I copied it from my other post.

    Yuniar can you fix it so that people do not get confused? I don't see an edit button or I would do it!

    Thanks,

    Mark

    Posted 16 years ago #
  5. yuniar

    Ok, I've fixed it.


    MachForm Founder

    Posted 16 years ago #
  6. Kort
    Member

    Thanks for that, it may prove useful to me too.

    Posted 16 years ago #
  7. nbngroup
    Member

    This post is a lifesaver - I never thought I would work that issue out.

    Posted 16 years ago #
  8. max
    Member

    Hi I have come up with a better way and works with all browsers

    (1) Paste The blow to the head

    <script language="JavaScript">
    <!--
    function calcHeight()
    {
    //find the height of the internal page
    var the_height=
    document.getElementById('the_iframe').contentWindow.
    document.body.scrollHeight;

    //change the height of the iframe
    document.getElementById('the_iframe').height=
    the_height;
    }
    //-->
    </script>

    -----------------------------------------------------------------------------------------------------------------------------

    (2)Paste the blow to the body and replace (page here) with your url

    <iframe width="100%" id="the_iframe"
    onLoad="calcHeight();"
    src="your page here"
    scrolling="NO"
    frameborder="0"
    height="1">
    An iframe capable browser is
    required to view this web site.
    </iframe>

    Have Fun

    Posted 15 years ago #
  9. yuniar

    max, thanks for sharing!


    MachForm Founder

    Posted 15 years ago #
  10. lynne
    Member

    I am new to all of this script stuff but a quick learner. Can someone make the instructions a little more detailed. I have the disappearing fields and submit button when an error is made filling on the form.

    Posted 15 years ago #
  11. yuniar

    Hi lynne,

    Basically, you'll need to paste those javascript code into the same page where you embed your forms.

    As for max instruction above

    1) Paste the code into your page head section. Head section is somewhere between <head> ..</head> tags. If your page doesn't have any <head> tag, you can add it yourself at the beginning of the page, after the <title> tag.

    2) Use the above code to embed your form. Replace the src="" part with your own form URL. For example src="http://www.appnitro.com/forms/embed.php?id=1"

    Hope that helps.


    MachForm Founder

    Posted 15 years ago #
  12. claycelestino
    Member

    I'm having problems not with the height by with the width of my embedded form: I tried embedding the form by using all 3 scripts (the html script works better) but none of them shows the right side of the form correctly. For instance, I can't see the right side of the recaptcha box or the right side of some of the fields. I can't see the "guidelines" I set up for some of the fields (mouseover effect). I tried adjusting that but I simply couldn't make it work - specially because I have limited knowledge on programming. I even tried both scripts listed in the previous entries without success. Any suggestions? here's a link to my "contact page" if you'd like to see how the form looks like: http://importexgbs.com/contact.php.
    Thank you so much for all of you for helping us with this Forum!

    Posted 15 years ago #
  13. yuniar

    Your iframe seems to have width: 130%.
    Have you tried to change it to 100%?


    MachForm Founder

    Posted 15 years ago #
  14. max
    Member

    Sorry I didn't make instructions more detailed. Yuniar got there before me "Thanks"

    Posted 15 years ago #
  15. claycelestino
    Member

    Thanks guys, but I'm still having problems. I changed the width to 100% and Firefox seems to show the page correctly; however, Internet Explorer doesn't (I can't still see the reCaptcha box completely and the messager that comes with the mouseover effect doesn't show on I.E. Any sugestions?
    Thanks for everything, Clay.

    Posted 15 years ago #
  16. yuniar

    Hmm.. try to use the other type of CAPTCHA.

    Edit your config.php file, search for this line:

    define('USE_INTERNAL_CAPTCHA',false);

    change it to become:

    define('USE_INTERNAL_CAPTCHA',true);

    MachForm Founder

    Posted 15 years ago #
  17. claycelestino
    Member

    I did update it. Although I can see the CAPTCHA image now, I can't see the messages that come with the mouseover effect. Any ideas about what I should do next?
    Thanks for all your help!

    Posted 15 years ago #
  18. yuniar

    there seem to be unclosed table tags and unnecessary form tag there.
    I've replied to your email for more details.


    MachForm Founder

    Posted 15 years ago #
  19. ronald
    Member

    it would be great if MachForm could be ported to a joomla module or even better a joomla component.
    Using a wrapper isn't great for these forms and as content it lacks then possibilities.
    Any one skilled to make such component?

    Posted 15 years ago #
  20. yuniar

    Thanks for chiming in. Joomla plugin seems to become a popular requests lately.


    MachForm Founder

    Posted 15 years ago #

RSS feed for this topic

Reply »