Hidden fields with custom id?

  • Profile Image
    Asked on April 16, 2012 at 05:06 PM

    I'm trying to add the following hidden fields to my form.... when I try to use the drag and drop method for adding the hidden field it does not allow me to update the ID. 

    How would I get the following fields added into my form? 

    <input type="hidden" name="SourceCampaign" value="" id="source" />

    <input type="hidden" name="SourceURL" value="" id="referrer" />


     thanks for any suggestions.

  • Profile Image
    Answered on April 16, 2012 at 06:52 PM


    You can actually add that code using Free Text HTML Tool, but I'm afraid it won't be included on the notification message. However, you can always download your form's full source code and modify the field ID's. To do that, simply add two Hidden Box element to your form, it's under Power Tools. After customizing, save it and get your form's full source code. You can then change the field ID's by opening the HTML field that is included when you download your form's source code.

    Hope I have made it clear. Let me know if you need a more detailed guide about this. Thanks.

  • Profile Image
    Answered on April 17, 2012 at 11:02 AM

    I've downloaded the css and js and form and installed it here http://bit.ly/Iud6uW ... i've changed the type from hidden to text temporarily so I can see if the cookie info is being passed to the form properly. Once I know it is and it is being sent properly in the emails I'll convert it to hidden. 

    =========== question 1 ==============

    Do I need to add something special to the Notification Emails to get the data to show up in the email? 

    ============ question 2 =============
    Something about the jotform js or css is preventing the cookie data from getting into the form... to illustrate I've setup two duplicate pages with one having the jotform js/css in the header and one not. Visit http://bit.ly/IudSbs and click on the link ( it is a special tracking link that will populate the cookie with campaign info ) . 
    Any ideas on how to get it working? Thanks!
  • Profile Image
    Answered on April 17, 2012 at 04:01 PM

    Busy day?

  • Profile Image
    Answered on April 17, 2012 at 06:27 PM


    Sorry for my late reply.

    1. No, you don't need to do that. What you need to do is to create first your two (2) hidden fields on the form builder not by creating it using your code. After that, download your form's source then edit the two hidden field ID's (only ID's). Note: Please do not change the field name's or else they will not be included on the email messages.

    2. I'm sure it's because of conflicting codes between your existing scripts and JotForm. One thing I've notice is you aren't using JotForm's Form HTML on your cookie test page. Please try to use JotForm's form not just its headers and let us know if that helps. If problem still persist, would suggest to re-embed your form using iframe code. This is to avoid code conflicts, since form is called on iframe.

    Contact us again if you have further questions. Thanks and have a great day!

  • Profile Image
    Answered on April 17, 2012 at 06:47 PM

    Thanks for the help on this... 

    ========= question 1 ==============

    I added them using the jotform drag and drop... then downloaded... this is what they look like: 

    <input type="hidden" class="form-hidden" value="" id="input_22" name="q22_clickTo22" />
    <input type="hidden" class="form-hidden" value="" id="input_21" name="q21_clickTo" />

    So I'll change only the ids so they look like this: 

    <input type="hidden" class="form-hidden" value="" id="source" name="q22_clickTo22" />
    <input type="hidden" class="form-hidden" value="" id="referrer" name="q21_clickTo" />


    ========== question 2 ==============

    I cannot use the iframe fix because I won't be able to pass my cookie data to the form. I did try using the full JotForm html ( see this page ) on the cookie test page but it did the same thing ( no cookie data passed to the form fields )... so I just tried to simplify things to help troubleshoot. 

    I guess I'll try removing other scripts until I find the culprit!

  • Profile Image
    Answered on April 17, 2012 at 07:11 PM

    1. Yes, that's correct :)

    2. Since you've already added the two hidden fields by following the first step. Try prepopulating it using URL parameters.

    Here's a sample link: http://www.crystalseas.com/cs-general-contact-roi-test-2012.htm?yourName[first]=pillar&yourName[last]=marketing

    This should also work with the two hidden fields created inside JotForm. It just doesn't work with your two embedded hidden fields, base on my test. Try that and let us know if that works. Thanks.

    Let us know if you have further questions. We'd love to help you here. :)

  • Profile Image
    Answered on April 17, 2012 at 07:25 PM

    Thanks, will the url parameter method be able to pull data out of the cookies? I'm trying to get my campaign lead source and original referring url info into a cookie when they arrive on any page of my site ( not just a landing page with a form ).... then when they visit the contact us page the cookie data is passed into the email. I'm following this method.

    I have it all working with my normal form but I'd like to get it working with Jotform! 

    Thanks for any more ideas.

  • Profile Image
    Answered on April 17, 2012 at 08:06 PM

    No, my apologies. Prepopulation can't work like that.

    Ok. Please try this method.

    Insert this code on the top part of your .php page



    $_SESSION['referrer'] = $_SERVER['HTTP_REFERER'];


    then, add this on your referrer hidden field value. 

    <?php $referer = $_SERVER["HTTP_REFERER"]; echo $referer; ?>


    <input type="hidden" class="form-textbox" id="referrer" name="q1_referrer" size="20" value="<?php $referer = $_SERVER["HTTP_REFERER"]; echo $referer; ?> " />

    Check this example:


    Hope I have made it clear. Let me know if you have any further questions. Thanks.

  • Profile Image
    Answered on April 17, 2012 at 08:09 PM

    I just show the referrer box on my sample so you will be able to see it. :)

    You can also test it. Just create a hyperlink pointing to: http://idarktech.com/test121.php, see if that gives you the correct referrer link. Thanks.

  • Profile Image
    Answered on April 18, 2012 at 02:33 PM
    This would work on some of my wordress sites but this customer's site is a static html site with .htm / .html pages. Thanks for any other ideas.
  • Profile Image
    Answered on April 18, 2012 at 07:08 PM


    Sorry but the codes above would only run on .php page. How about creating one .php page just for the sake of the referrer, wouldn't it be nice? :)

    Nevertheless, I'll try to look around maybe I can find something that fit your needs. Please stay tuned for updates. Thanks!

  • Profile Image
    Answered on April 18, 2012 at 07:35 PM

    You may try this for your html pages.

    Insert this code on your html page, just before </head> tag

    <script type="text/javascript">

    function start() {

    var ref = document.getElementById('input_1');

    ref.value = document.referrer;


    onload = start;


    Be sure to replace the input_1 to your hidden field ID. That should work, you can try a demo here: http://www.idarktech.com/referrer_test.html

    Let me know if you need any further assistance. Thanks for using JotForm!

  • Profile Image
    Answered on May 31, 2012 at 03:44 AM

    Thanks for your help on this... sorry for the delayed response... I tried going another way with this that almost worked except it also confliced with jotform ( in ie only ) .... 

    With regards to your last post above... it looks like that method will only work if the landing page is the form..... I mean the referrer is always the most recent page so the original referrer would be lost. Correct? 

    This is why the cookie method seems like the only way to go. 

  • Profile Image
    Answered on May 31, 2012 at 04:30 AM


    Thanks for your reply.

    I guess you are right, my last post means getting the URL where the form is embedded or get the current URL on your address.

    Well, I think that cookie you've mentioned would do for now. :)

    However, if some of my colleagues has solution for this, well update you in this thread but I can't promise anything as this seems to be very difficult, to me.

    Thanks and have a pleasant day!