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.
Lightbox opens every time a new page is loaded from the website?Asked by discoverdelicious on July 21, 2016 at 07:47 AMThe Lightbox opens every time a new page is loaded from the website. I've had a look for this problem and it seems to be a common one. However the PHP solution generally offered is a little beyond me. Could you help me out?
I am note sure if I understood your concern correctly.
If you have enabled the "Open on page load" in the "Publishing" wizard before you copy the embed code, then that will automatically set your form to open whenever the page is loaded.
Here's a quick step by step on how to find that option:
1. On the "Publish" wizard, select the "Lightbox" option and click the "Customize" button.
2. You can see the "Open on Page Load". This option will generate an embed code that will automatically opens the form when the page is loaded.
To learn more about the Lightbox embed code, you can check the following guides:
I hope that helps.
No basically I have set a delay for the lightbox to open but it opens after x seconds on every page that a user loads. So if they have clicked off the form because they didn't want to enter their email, or if they have already entered their email, the next page they load the lightbox form pops up again.
I'd like the lightbox to appear once per session?
Here is the same question as mine asked previously - I cannot understand the solution to it. https://www.jotform.com/answers/546330-My-Lightbox-Opens-Automatically-on-Every-Visit-to-My-Web-Page-How-Can-I-Get-It-to-Do-so-Only-Once-per-Browser-Session
If you would like to open the lightbox embed code based on cookies, then we actually have 2 guides for that. Here they are:
Option #1: If you can code in PHP, then this will help: https://www.jotform.com/help/140-Using-cookies-to-auto-open-a-lightbox-form-per-browser-session
I personally recommend using option #2, you can just copy the custom script from there and replace it with your own. If you are having problems, you can provide us your Lightbox embed code and I'll place it in the custom script that I have.
We'll wait for your response.
Ok thanks I've gone through option 2 for a while and seems like I've got it to work. However I am having problems incorporating it with my already customised code. So my code before was adjusted in two ways. Firstly it was adjusted to that the width would be the correct width for a mobile device. Secondly it was adjusted so that there was a delay of 10 seconds or so before the pop up appeared.
This was my code before:
But now that I'm trying to get the code to only appear once per browser session, your proposed solution requires me to change the openOnLoad value to true which means the delay doesn't work. So here is the code that I incorporated into your option 2 solution which doesn't work because (I think) the openOnLoad problem.
What can I do? Thanks
I see, I checked your custom script, try changing the "openOnLoad" attribute on your code from true to false. That should make your script work as expected.
Here's your custom script but I have changed the openOnLoad attribute in the code to false: https://shots.jotform.com/charlie/custom_lightbox_887634.html. See if that works as you expected.
We'll wait for your response.
Yay I think it works. I think when I changed the openOnLoad before myself I thought it wasn't working because the pop up didn't show but that was because it had the cookie so in fact it was working!!
Thanks for all your help guys.
You are most welcome. If you face any issue, or need further assistance, feel free to revert back.