How to disable or never show the lightbox form again after someone submits it?

  • Profile Image
    andrewholman
    Asked on March 06, 2018 at 10:07 PM

    I have a pop up signup form on my website.  How do I set the code to disable the pop up form appearing once someone submits the form?

    For the frequent viewer it can be quite annoying.

    I did find a way to enable cookie sessions that keeps the pop up from appearing until the user quits their browser.

    thx,

    a

  • Profile Image
    Nik_C
    Answered on March 07, 2018 at 02:34 AM

    This guide should be exactly what you need: https://www.jotform.com/help/378-Auto-Popup-Lightbox-Embed-Form-With-Cookie-Using-Javascript

    It will allow you to control to whom the popup will be shown, based on their cookies (if they saw the page or not).

    Let us know if you have any further questions.

    Thank you!

  • Profile Image
    andrewholman
    Answered on March 17, 2018 at 05:23 PM

    What I am looking to do is to keep the cookie & user session active, not destroyed, after someone fills out the form and then quits their browser. This way when return visitors come to the site they will not receive the popup that they already signed up for.

    Is this possible?

    If so, how can I do this?

    thx,

    a


  • Profile Image
    Welvin
    Answered on March 17, 2018 at 06:44 PM

    I'm sure this is possible, but I think this needs you to redirect the form to a page, a thank you page where a cookie can be set with a URL value. 

    The lightbox shows the thank message in the same window, and I don't think you can set a cookie that way. I will try to look into this, and let you know. 

  • Profile Image
    andrewholman
    Answered on March 19, 2018 at 01:51 PM

    ok, thanks.  Please let me know if possible and how I can do this.

    A



  • Profile Image
    andrewholman
    Answered on March 20, 2018 at 09:12 PM

    Hi ,any updates with this question?

    thx,

    a

  • Profile Image
    EltonCris
    Answered on March 20, 2018 at 10:57 PM

    There's a workaround. This would require an external thank you URL hosted on your website that would set a cookie on the user's browser when the form is submitted. If you'd like to try it, here's how:

    1. First, you need to create your custom thank you page with the cookie script.

    Copy the codes here https://pastebin.com/raw/AwsT3G0h, save it as PHP file e.g. thankyou.php

    2. Save the thankyou.php file into the root folder of your website e.g. http://illuminatefilmfestival.com/thankyou.php

    3. Set the thankyou.php as your external Thank you URL.

    4. Lastly, update the PHP code that is embedded on your website with the following.

    <?php

    $showlightbox="0";

    if(!isset($_COOKIE['beenhere']) && !isset($_COOKIE['formExpiry'])) { 

     setcookie("beenhere", '1');

     $showlightbox="1";

    }

    ?>

    So this is how it'd work.

    a. When the user visits your website for the first, the lightbox form is shown

       --If the user closes the browser without submitting the form, the form will be shown again as soon as they revisit the page

    b. If the user submits the form, another cookie without expiration will be added to their browser so when they visit your website again, they won't be able to see the form unless they will clear their browser's cache and cookies.

    If you have further questions, let us know.

  • Profile Image
    andrewholman
    Answered on March 23, 2018 at 01:12 AM

    Perfect, I really appreciate this. I will give it a try.


  • Profile Image
    andrewholman
    Answered on March 27, 2018 at 04:49 PM

    Hello,

    I implemented the pop up code on the index and the thank-you.php page and currently the only browser that functions properly is Chrome.  Safari & Firefox do not even show the pop up for me even after clearing the cookies.

    illuminatefilmfestival.com/index.php

    illuminatefilmfestival.com/thank-you.php

    What am I missing?

    thx,

    -------

    Below is the index.php code:

    <?php header('Content-type: text/html; charset=utf-8'); ?>

    <?php include('includes/loadrecords2016.php'); ?>

    <?php

    $showlightbox="0";

    if(!isset($_COOKIE['beenhere']) && !isset($_COOKIE['formExpiry'])) { 

     setcookie("beenhere", '1');

     $showlightbox="1";

    }

    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml"><head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <title><?php echo htmlencode($home_page_contentRecord['meta_title']) ?></title>

    <META NAME="description" content="<?php echo htmlencode($home_page_contentRecord['meta_description']) ?>"> 

    <?php include("includes/js-hover.php"); ?>

    <?php include("includes/css-home.php"); ?>

    <?php include("includes/global.php"); ?>

    <?php include("includes/videoplayer.php"); ?>

    <?php include("includes/layerslider.php"); ?>

    <?php if ($showlightbox) { ?>

    <script src ="https://form.jotform.com/static/feedback2.js" type="text/javascript"></script><script type="text/javascript"> var JFL_80247286332153 = new JotformFeedback({ formId: '80247286332153', base: 'https://form.jotform.com/', windowTitle: 'Opt In Form #3', background: '#FFA500', fontColor: '#FFFFFF', type: '1', height: 450, width: 500, openOnLoad: true }); </script>

        <?php } ?>

    </head>

    <body>
    <div id="maincontainer">
    <?php include("includes/header.php"); ?>
    <?php include("includes/nav.php"); ?>
    <?php include("includes/slider2017.php"); ?>
    <?php include("includes/highlight-box.php"); ?>
    <?php include("includes/horizontal-sidebarFORM.php"); ?>
    <?php include("includes/featured.php"); ?>
    <?php include("includes/mission-statement.php"); ?>
    <?php include("includes/sponsors2016.php"); ?>
    </div><!--end maincontainer-->
    <?php include("includes/footer.php"); ?>
    </body>
    </html>

    -----------------

    Thank-you.php code:

    <?php

     //set value on form submit

     setcookie(

       "formExpiry",

       "JotForm",

       time() + (10 * 365 * 24 * 60 * 60)

     );

    ?>

    <!DOCTYPE html>

    <html>

    <head>

    <title>Thank You</title>

    </head>

    <body>

        <div id="stage" class="form-all"><p style="text-align:center;"><img src="https://cdn.jotfor.ms/img/check-icon.png" alt="" width="128" height="128" /></p><div style="text-align:center;"><h1 style="text-align: center;">Thank You!</h1>

        <p style="text-align: center;">Please check your email for the  link to download your top 10 list.</p></div></div>

    </body>

    </html>

  • Profile Image
    Welvin
    Answered on March 27, 2018 at 05:54 PM

    I'll ask my colleague about this. We'll keep you posted.