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

Adding URL to Data submitted


  1. lamina
    Member

    Hi, I would like to record the URL of the page from which a form is submitted. The form is included in a modal iframe. Is this possible and how do I go about doing this?
    I have searched the forum to no avail :-(

    Regards
    Richard

    Posted 13 years ago #
  2. redityo

    This possible with some customization. First of all, you need to add 1 single line text field into your form to hold the page url data. Then edit "includes/view-functions.php" file and go to around line 1682, you'll see these code :

    $element[$j]->default_value = htmlspecialchars($row['element_default_value']);

    then put these code bellow that line

    if ($form_id == 9  && $element[$j]->id ==1 ) {
    	$element[$j]->default_value = $_SERVER['HTTP_REFERER'];
    }

    After that, you can add these css code to hide the new field.

    #li_1 {
    display:none !important;
    }

    In there I assume your form id is 9 and the field element id to hold url data is 1. You need to change those id's with yours.


    MachForm Support

    Posted 13 years ago #
  3. lamina
    Member

    Hi redityo,
    Thank you for the prompt reply. I cannot find the $element[$j] line in includes/post-functions.php - I am using the latest Machform version 2.4. Can you assist please?
    Many thanks
    Richard

    Posted 13 years ago #
  4. wjoell
    Member

    Hi, could this post please be updated to cover the syntax changes in post-functions.php (v2.4)? A lot has changed in there and I'm having a hard time figuring out how to use the method above.

    Thanks,
    Winston

    Posted 12 years ago #
  5. redityo

    Hi Winston,

    The file name should "view-functions.php", you can try to search the code in there. For version 2.4 the line is on 1690


    MachForm Support

    Posted 12 years ago #

RSS feed for this topic

Reply