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

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Return domain information in form results


  1. akerr
    Member

    So I am using the same form across a variety of sub domains (site1.example.com, site2.example.com, etc), I'm wanting to return the sub domain each time a person fills out the form from (for example site1.example.com), it would act similar to passing pack the IP details. Thanks in advance.

    Posted 10 years ago #
  2. akerr
    Member

    So I ended up finding the solution on the Machform 2 forum section, here's the full post: http://www.appnitro.com/forums/topic/passing-a-url-into-a-hidden-field?replies=14

    Here's the solution:
    In order for this solution to work you must use the JavaScript embed option.

    Step 1) Create a form text field and label it something along the lines of "URL Reference" then add the class hidden under the form field properties

    Step 2) Go to the "edit themes" tab within the Machform backend and modify your theme using the "advanced CSS" under the dropdown arrow near the top-right of the theme section, an add this code:

    .hidden {
    display:none;
    }

    This code will hide the URL data from the user but pass it into the form so that when the user submits the form you can see on the backend.

    Step 3) Modify your embed code so that after the id=(in the example below 14641) you add the following snippet <?php echo '&element_4='.urlencode($_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]); ?>

    Make sure that you also modify the &element_4 to reflect the text field you created above to pass in the hidden value.

    Modified Embed Code that passes in URL:

    <script type="text/javascript">
    var __machform_url = 'http://mysite.com/forms/embed.php?id=14641<?php echo '&element_4='.urlencode($_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]); ?>";
    var __machform_height = 505;</script>
    <div id="mf_placeholder"></div>
    <script type="text/javascript" src="http://mysite.com/forms/js/jquery.min.js"></script>
    <script type="text/javascript" src="http://mysite.com/forms/js/jquery.ba-postmessage.min.js"></script>
    <script type="text/javascript" src="http://mysite.com/forms/js/machform_loader.js"></script>

    Hope this helped you.

    Posted 10 years ago #

RSS feed for this topic

Reply