Report page where form was submitted from

  • Profile Image
    electrovehicles
    Asked on March 10, 2011 at 02:53 AM

    Hi

    I'd like to include the URL of the page the pop up form was launched from in the email report. This way I can which which product the enquiry form was launched from.

    Is this possible?

    http://www.electrovehicles.co.za/agriculture/electric-hi-rise-2-seater-utility-vehicle

    Click the red button in left column and see the pop-up form

    Regards,
    Rob Hope 

  • Profile Image
    DanielGriffin
    Answered on March 10, 2011 at 08:35 AM

    Hi there,
    It's a bit tricky to achieve that.  I would really recommend getting a developer to handle it for you.

    You would need to embedded the entire code into your own page rather than just a popup to JotForm.  You could then create a hidden field in the form and populate that field with the referrer page (that's easy to do with a server side language like PHP or ASP, but trickier with javascript).

    so for example, your button links to

    javascript:void(%20window.open('http://www.jotform.com/form/10672152108',%20'blank','scrollbars=yes,toolbar=no,width=500,height=500'))

    but if you embedded it then the "http://www.jotform.com/form/10672152108" part would point to your own page; eg "www.electrovehicles.co.za/myForm.php"

    In that page you would need to write the referrer value into the hidden field.  Here's a good tutorial on how to find the referrer page with PHP

    http://www.plus2net.com/php_tutorial/php_referrer.php

    Hidden fields are available in the form builder under Power Tools.

    Thanks,

    Daniel

  • Profile Image
    allanftd
    Answered on March 10, 2011 at 08:54 AM

     

    Hi Rob,

    Thank you for contacting us regarding your concern. With JotForm, it is possible to identify which page the enquiry form your visitor has filled out came from. Please follow these steps: 

    1) Open your form in editing

    2) On the left accordion menu put a hidden field on your form (on Power Tools> Hidden box)

    3) Change the label of your field to "pageAddress"

    4) Save your form.

    5) Take the full source code of your form (Share>Advanced Options> Full Source code)

    6) There should be a similar line below right before the tag </form> starting with

    <input type="hidden" class="form-hidden" ...

    <input type="hidden" class="form-hidden" value="" id="input_5" name="q5_pageaddress5" />

    Keep note of the id of this line. For this example it is input_5

    7) Paste the html source code of your form to your page but you will need to add these lines right after </form> tag

    <script>

    document.getElementById('input_5').value=location.href;

    </script>

    NOTE: I have used the id I have found in step 6 in the code. You will need to change the input_5 with your id that you have found in step 6.

    Please try the steps above and let us know if it works for you or not. 

     

    Thanks,

    Allan

     

     

       

  • Profile Image
    electrovehicles
    Answered on March 11, 2011 at 06:55 AM

    Hi Daniel, Hi Allan

    Thank you for your replies, I combined both your suggestions and cracked it!

    1. I added the hidden field

    2. Then copied all source coded into my own page.

    Because the form is in a pop-up I need a referrer URL, using this php:
    $ref = $_SERVER['HTTP_REFERER'] 

    3. So in the hidden field you simply drop the php in 'value' and echo the result

    <input type="hidden" class="form-hidden" value="<?php $ref = $_SERVER['HTTP_REFERER']; echo "$ref";   ?>" id="input_10" name="q10_pageaddress" /> 

    4. Lastly add the extra new row in the email notifications (wish jotform would autimatically do that by the way)

    And all is good!

    Hope that helps others.

    Cheers,
    Rob