Pass URL to Lightbox Delayed AutoPopup

  • Profile Image
    precisionsails
    Asked on October 12, 2013 at 04:18 PM

    I have tried uncessefully to pass a page URL to a hidden field in my lightbox form that is set to autopop up on page lode.

    Im sure the problem has to do with the autopopup and not clicking on a link.  How can i modify my code to get the page url to pass into my hidden field named q13_pageaddress when using delayed auto popup lightbox?



    The code I am using is as follows:

    <script src="//www.jotform.com/min/g=feedback" type="text/javascript">
    new JotformFeedback({
    formId:'32845595620258',
    base:'http://jotform.ca/',
    iframeParameters: {
    'q13_pageaddress': document.URL},
    windowTitle:'Let us help you.',
    background:'#FFA500',
    fontColor:'#FFFFFF',
    type:false,
    height:500,
    width:700,
    });

    </script>

    <a id="lightboxdelay" class="lightbox-32845595620258" style="cursor:pointer;color:blue;text-decoration:underline;"> </a>


    <script language="JavaScript">

    var delayseconds = 1;
        function pause() {
        myTimer = setTimeout('whatToDo()', delayseconds * 1000)
        }

       function whatToDo() {
    document.getElementById('lightboxdelay').click();
       }

    window.onload = pause;

    </script> 

  • Profile Image
    EltonCris
    Answered on October 12, 2013 at 06:48 PM

    Hi,

    Your code is fine, however you have to use the hidden field name after the underscore. So from q13_pageaddress to pageaddress only.

    Example:

    <script src="//www.jotform.com/min/g=feedback" type="text/javascript">

    new JotformFeedback({

    formId:'32845595620258',

    base:'http://jotform.ca/',

    iframeParameters: {

    'pageaddress': document.URL

    },

    windowTitle:'Let us help you.',

    background:'#FFA500',

    fontColor:'#FFFFFF',

    type:false,

    height:500,

    width:700

    });

    </script>

    <a id="lightboxdelay" class="lightbox-32845595620258" style="cursor:pointer;color:blue;text-decoration:underline;"> </a>

    <script language="JavaScript">

    var delayseconds = 1;

        function pause() {

        myTimer = setTimeout('whatToDo()', delayseconds * 1000)}

       function whatToDo() {

    document.getElementById('lightboxdelay').click();}

    window.onload = pause;

    </script> 

    That should work. Cheers!

  • Profile Image
    precisionsails
    Answered on October 12, 2013 at 07:29 PM

    lol, thank you so much. Rediculous how much extra time this took me all because of a few little letters!

  • Profile Image
    EltonCris
    Answered on October 12, 2013 at 07:52 PM

    @precisionsails

    No worries. I have also encountered this before without knowing that names should be like that unlike normal forms. :)

    Thanks for using Jotform by the way. 

    Regards!