What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    I can not get the referrer script to work

    Asked by krp54 on November 21, 2012 at 07:57 AM

    Hi there,

     

    Thank you for the script, but i can't get it working on my website. try clicking this button http://prntscr.com/k8ftt

     

    on a webpage: http://krp54.ru/XT-120.html

     

    Can you help please?



    This is a re-post of a comment on Capture the Page URL Where the Form is Embedded

  • Profile Image
    JotForm Support

    Answered by idarktech on November 21, 2012 at 08:08 AM

    Hi,

    I just made a clone of your form and saved it as html file locally, it works fine after testing on it. Here's what I received:

    Is everything working fine now? If not, try replacing your existing codes with this:
    <script type="text/javascript">
    document.write("<iframe allowtransparency=\"true\" src=\"http://www.jotform.com/form/23252177142346?referrer=" + window.location.href + "\" frameborder=\"0\" style=\"width:100%; height:164px; border:none;\" scrolling=\"no\"></" + "iframe>");
    </script>
    Thanks!
  • Profile Image

    Answered by livingfresh on November 21, 2012 at 08:32 AM

    Hi! Thank you,

    but i've got this stuff above the head after inserting a script provided. http://prntscr.com/k8ly8

  • Profile Image
    JotForm Support

    Answered by idarktech on November 21, 2012 at 08:43 AM

    Hi,

    Thanks for the prompt response. This is how it displays on my Chrome, IE and Firefox Browser as of this writing.

    Please be sure to replace the existing codes correctly. There's actually no changes on the code except the spacing on the last iframe closing tag e.g. </" + "iframe>");

    Here's the code again:

    <script type="text/javascript">

    document.write("<iframe allowtransparency=\"true\" src=\"http://www.jotform.com/form/23252177142346?referrer=" + window.location.href + "\" frameborder=\"0\" style=\"width:100%; height:164px; border:none;\" scrolling=\"no\"></" + "iframe>");

    </script>

  • Profile Image

    Answered by livingfresh on November 21, 2012 at 09:00 AM

    thank you, now i've got it working, i've just changed the url to www.jotformeu.com/... 

     

    Then i have another problem - by button click i load a page credit_form.html to the fancybox and i'm getting a url that shows /credit_form.html as a referrer neither than /XT-120.html - from where the submission really came from.

    How to make it work properly?

  • Profile Image
    JotForm Support

    Answered by idarktech on November 21, 2012 at 10:12 AM

    That's great! Glad to hear you've managed to sort it out.

    --

    That's simply because the form is embedded at credit_form.html (on a separate html page) and this is the main reason why it shows this URL as a referrer. Unfortunately, this is how the script works. In order to make this working properly you have to place the embed code directly on the page where you'd like to get its referrer e.g. at XT-120.html

    Another alternative solution is to use a lightbox embed code and use its parameters in order to get the correct referrer. 

    Thanks and apologies for the delay.

  • Profile Image
    JotForm Support

    Answered by idarktech on November 21, 2012 at 10:45 AM

    You can use the following lightbox code if you like.

    <script src="//max.jotfor.ms/min/g=feedback" type="text/javascript">

    new JotformFeedback({

    formId:'23252177142346',

    base:'http://jotformeu.com/',

    iframeParameters: {

         'referrer': window.location.href

    },

    windowTitle:'Заявка на кредит',

    background:'#FFA500',

    fontColor:'#FFFFFF',

    type:false,

    height:180,

    width:350

    });

    </script>

    <a class="lightbox-23252177142346" style="cursor:pointer;color:blue;text-decoration:underline;">Заявка на кредит</a>

    It should function like this: http://idarktech.com/test_lightbox_code.html

    Thanks!

  • Profile Image

    Answered by krp54 on November 22, 2012 at 03:22 AM

    Hi, thank you!

    This is a solution,

     

    However, is it possible to get a parameter of a page where the iframe is opened?

  • Profile Image

    Answered by fxr on November 22, 2012 at 03:30 AM

    That is what it is doing, the referer variable is set to the value of the page which contains the link to the iframe/lightbox.

  • Profile Image

    Answered by livingfresh on November 22, 2012 at 08:33 AM

    Can't understand how to get it working.

    I have a ./xt-120.html page and i load a fancybox iframe on buttonclick with ./credit_form.html page content that has a form embedded.

    How can i pass a ./xt-120.html URL or any other unique parameter to the hidden form field "referrer" ?

  • Profile Image
    JotForm Support

    Answered by NeilVicente on November 22, 2012 at 08:47 AM

    @livingfresh

    The guide How to Know the Exact URL of a Page From Which a Submission Came applies only to forms embedded using iFrame or script-based Embed codes. However, you are using a custom script for "lightbox-ing" your form, so this is a little tricky because the form is embedded on xt-120.html that is linked from credit_form.html. The actual referrer is xt-120.html because it is the one that calls the form from our servers.

    Can't you just use our built-in lightbox script to embed your form, as opposed to embedding the form in a separate page and opening that page via fancybox?

    Your setup will require extra cumbersome steps in order to capture the referrer URL, whereas our built-in lightbox script will only need a few lines of additional code.

    Please let us know you're okay with the alternate solution we propose, and we will walk you through it.

  • Profile Image

    Answered by livingfresh on November 22, 2012 at 10:05 AM

    ok, let's do it. Let's embed the lightbox (last time when i tried to embed a form via lightbox i got conflicts with jquery versions)

  • Profile Image
    JotForm Support

    Answered by NeilVicente on November 22, 2012 at 10:20 AM

    1.  Embed the codes provided by idarktech to your form website. Here's a cleaner version:

    http://pastie.org/pastes/5418614/text

    2.  In your page's source code, find the reference to jQuery library

    3.  Paste the following code right after the jQuery reference:

    <script type="text/javascript">
      $.noConflict();
    </script>

    So it becomes:

    <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
    <script type="text/javascript">
      $.noConflict();
    </script>

    4.  Save your webpage

  • Profile Image

    Answered by livingfresh on November 22, 2012 at 11:12 AM

    thank you, i've got it done, everything works fine.

    here is another task:

    what if i have several buttons on a page calling the same form? and i need these buttons to bypass a unique parameter to the referrer field.

    therefore i should keep one copy of the script inside the page and change referrer parameters, right? Could you please help to manage it? 

  • Profile Image

    Answered by livingfresh on November 22, 2012 at 11:23 AM

    *change referrer parameters by onbuttonclick event.

     

    looking for your response

  • Profile Image
    JotForm Support

    Answered by NeilVicente on November 22, 2012 at 12:04 PM

    We'll try to make this work for you. We'll get back to you with a solution.

    Thank you for your patience.

    Sorry for taking too long to update you. Unfortunately, after playing around with the feedback codes, I was not able to find a solution to your requirement.

    What you want to accomplish is not quite possible. Sorry about that.