The code to know the URL where my submissions come from is not working correctly

  • Profile Image
    beatsahead
    Asked on September 10, 2013 at 09:24 AM

    ve this code, the forms are coming through fine but it#s not giving me the url, can anyone tell me where i'm going wrong please?

    One of the pages is http://www.beatsahead.com/london-dj-your-dj-in-london/



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

  • Profile Image
    EliezerN
    Answered on September 10, 2013 at 10:36 AM

    Thanks for contacting us.

    Please remove the current code and use this Code to embed to your webpage, that should work correctly now:

    <script type="text/javascript">

    document.write("<script type="text/javascript" src="//support.jotform.com/jsform/30435174568356?pa=" + window.location.href + "/"></" + "script>");

    </script>

    It's made according to the embed code of your form. I have highlighted each part with different colors:

    First Part.

    Second Part.

    Third Part.

    If this code still gives you troubles, don't hesitate to contact us.

    Thanks

  • Profile Image
    beatsahead
    Answered on September 10, 2013 at 10:45 AM

    Thanks, I just tried that script, but then the form does not show at all.

  • Profile Image
    EliezerN
    Answered on September 10, 2013 at 11:48 AM

    I deeply apologize, it seems that I was missing some backslashes, that's why the form was not displayed. It is already corrected, this is the new code:

    <script type="text/javascript">

    document.write("<script type=\"text/javascript\" src=\"http://support.jotform.com/jsform/30435174568356?pa=" + window.location.href + "\"></" + "script>");

    </script>

    However it seems the email notification is still not showing the URL from the submission comes from. 

    So, I would appreciate if you give me some time and I will work on it to find a solution. I will get back to you when I get it fixed or when I have information about this.

    Thanks

  • Profile Image
    EliezerN
    Answered on September 10, 2013 at 08:14 PM

    Hello again beatsahead,

    Sorry for the delayed reply.

    After cloning your form and making some tests I was able to find that the word "pa" you are using for the hidden field is the cause of the issue. When using that word the URL won't appear: 

    However, when using a longer word it works fine, for example when using the word "page":

    So, I changed the word "pa" to "page" in your form and elaborated the code for you. So that the code you need to use now is this: 

    <script type="text/javascript">

    document.write("<script type=\"text/javascript\" src=\"https://www.jotform.com/jsform/30435174568356?page=" + window.location.href + "\"></" + "script>");

     

    </script>

    It should work perfectly now. So, please embed it to your webpage, test it and let us know if it worked or if you need further assistance.

    Thanks for using Jotform

  • Profile Image
    beatsahead
    Answered on September 11, 2013 at 02:48 AM

    Thanks for looking into it, but that code doesn't show the form at all again.

  • Profile Image
    EltonCris
    Answered on September 11, 2013 at 03:07 AM

    @beatsahead 

    The code provided by my colleague works for me. You may try it again using the following embed code.

    <script type="text/javascript">document.write("<script type=\"text/javascript\" src=\"https://www.jotform.com/jsform/30435174568356?page=" + window.location.href + "\"></" + "script>");</script>

    Result would be like this. It copies the page URL into the hidden box on your form.

    Thanks!

  • Profile Image
    beatsahead
    Answered on September 11, 2013 at 08:33 AM

    I couldn't get that to show up, this works, and I get the url

    <script type="text/javascript">document.write(" <script src=\"http://form.jotform.com/jsform/30435174568356?page= " + window.location.href + " \"></ " + " script> ");</script>

    but nothing on the page below it shows, I can't see what the problem with the script is.

  • Profile Image
    pinoytech
    Answered on September 11, 2013 at 09:47 AM

    Hi,

    I think the issue is had something to do with your site's current doctype <!DOCTYPE html> which is the reason why scripts not functioning properly.

    Please change your website's doctype with this: http://pastie.org/5045575 and re-embed your form's code into your form again.

    <script type="text/javascript">document.write("<script type=\"text/javascript\" src=\"http://www.jotform.com/jsform/30435174568356?page=" + window.location.href + "\"></" + "script>");</script>

    Thank you!

  • Profile Image
    beatsahead
    Answered on September 11, 2013 at 01:43 PM

    Can you tell me where to put that, it's a wordpress site, I can edit the files, but I need to know which file to edit.

  • Profile Image
    beatsahead
    Answered on September 11, 2013 at 02:13 PM

    Thank you so much for all your help, I found the DOCTYPE in the header.php, and with the last script its all working well.

  • Profile Image
    pinoytech
    Answered on September 11, 2013 at 02:16 PM

    Hi,

    Good to hear that everything is working fine now. If you need our assistance again, feel free to contact us at anytime.

    Have a nice day!