One Contact Form on Multiple Pages: Which page did the form submission come from? Here's how!

Sep 15, 2015 11:25 am

Problem: You have a website with a single contact form that you have embedded on multiple pages (such as a side bar) and you want to know what page the form submission came from.

Solution: Use JavaScript to pull the current page location and enter it into the value of a hidden field on the form.

-----
Step 1: Edit your contact form and add a Hidden Field
-----

Field Type: Custom
Unique ID: WindowLocation
Input Method: Hidden
Value: (leave blank)

-----
Step 2: Create a Static HTML Field & Add JavaScript
-----

Field Type: Static
Input Method: Free-form HTML
Value: Use the JavaScript Example Below


<script type="text/javascript">
  $(document).ready(function() {
    $('input[name="formField_Name_Goes_Here"]').val(window.location.href);
  });
</script>

Note: To obtain the Hidden Field's Name value you can do so by previewing the Web Form > Right-click > Inspect Element > Look for the "WindowLocation" Input.

Now Form Submissions will include the Value of the Hidden Field with the URL that the Form was submitted on.