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

Changing domain name in MachForm


  1. markritchie
    Member

    I am currently using some javascript to automatically expand the height of the iframes which hold the forms. When I originally installed MachForm I installed using the servers IP address as the site was not live yet.

    Now that the site is live the javascript no longer works by going to the actual domain name because the javascript is not cross-domain compatible. I would rather not uninstall and reinstall MachForm but instead change it's install location to the actual domain name rather than the IP.

    Can I also apply multiple domain names somehow to the script? This would be ideal!

    How would I go about doing this?

    Thank you,

    Mark

    Posted 16 years ago #
  2. yuniar

    I'm not really sure what do you mean by changing domain name, as MachForm doesn't use any specific domain setting. You should be fine using both IP address and domain name, as long as they are both pointing to the same server.

    Or do you mean you have a new server for the domain? If so, you can simply copy the whole MachForm folder and database to the new server. No need to reinstall again.

    Can you send me the link to your form? Or paste me the javascript code.

    If you don't feel comfortable posting it here, please mail it to yuniar [at] appnitro.com


    MachForm Founder

    Posted 16 years ago #
  3. markritchie
    Member

    Hi Yuniar,

    I am using the javascript provided by Dynamic Drive. You can view the code by going to:

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

    Then please visit:

    http://199.238.178.153/contact.php

    You will see the form. Do not fill anything out and hit the submit button. You will see how the form and iFrame expands down automatically. It works perfectly!

    If you visit the site via the domain name you will see submitting the form without filling anything out does not expand.

    http://telmantec.com/contact.php

    The problem is the javascript obviously. When I originally installed MachForm I installed using the IP address as the site was not live. As you know, the "embed" code that machform provides states the IP address (or domain) in the code:

    Example:

    <iframe id="myframe" height="570" allowTransparency="true" frameborder="0" scrolling="no" style="width:95%;border:none;" src="http://199.238.178.153/forms/embed.php?id=2" title="General Contact Form">General Contact Form</iframe>

    Now I could of course change the IP address in the embed code to telmantec.com but then the javascript will only work when people visit the site via that domain name. The site actually has 5 different domain names that point to it.

    This all is not an issue with machform but an issue with the javascript. The javascript does work perfectly though for people who use only 1 domain name. I'll actually make a different post about it so people can use it.

    Mark

    Posted 16 years ago #
  4. yuniar

    Oh.. this is really nice script.

    I think I have a solution for your domain/ip problem.
    Simply change your iframe embed code to use dynamic source instead of fixed address.

    Your original code:

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


    Now replace that code with this:

    <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>


    That code would automatically change the source of your iframe, depends on from which domain your user access it.

    The point is to replace your ip/domain with this code:

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

    Let me know the result.


    MachForm Founder

    Posted 16 years ago #
  5. markritchie
    Member

    It works beautifully! Thanks A LOT yuniar!

    Mark

    Posted 16 years ago #
  6. yuniar

    Mark, no problem! :-)


    MachForm Founder

    Posted 16 years ago #

RSS feed for this topic

Reply