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.


  • Profile Image

    Is it possible to make the lightbox auto-popup via a URL?

    Asked by davidvm on May 25, 2017 at 03:01 AM

    Hi, is it possible to make the lightbox auto-popup via a URL? I don't want the form to auto-pop for all visitors, but just for some I give a special link, so by clicking on it they will go to my site and have the form auto pop. Is that possible?



    This is a re-post of a comment on How to Auto-popup a Lightbox Form

  • Profile Image
    JotForm Support

    Answered by Nik_C on May 25, 2017 at 04:05 AM

    So if you give your customers a link yo your website, when they click the link the form should auto pop-up there?

    If that's the case could the first option here https://www.jotform.com/help/203-How-to-Auto-popup-a-Lightbox-Form work for you:

    I'm sorry if I misunderstood the question.

    Please let us know.

    Thank you!

     

  • Profile Image

    Answered by davidvm on May 25, 2017 at 04:23 AM

    Hey Nick,

    Yes, that is correct. But can this be done using the same page with openOnLoad:false, but have it set to 'true' via the URL? Something like site.com/?openOnLoad=true or site.com/?lightbox, so that I don't have to use a second page with openOnLoad:true in the lightbox script.

  • Profile Image
    JotForm Support

    Answered by Nik_C on May 25, 2017 at 04:40 AM

    I understand what you mean, but that is not possible, unfortunately, the openOnLoad=true is part of script code and that parameter can not be passed to script through URL in that way. 

    Maybe the easiest way would be to clone that whole page allow popup in one of them and disable the pop up in the second one. Then you can share each of the URL as you need.

    But I guess you were already aware of it.

    I couldn't find any easier way to prevent popup.

    Let us know if you need any further assistance.

    Thank you!

     

  • Profile Image

    Answered by davidvm on May 25, 2017 at 04:07 PM

    Thanks Nik, yes, I'm considering using a clone page.

    However, I've found an alternate way: Instead of using your lightbox, I can use the regular embed code and add it to a lightbox of my own, and then I can add a class to it to make it visible depending on the URL, using this script I found:

    <script type="text/javascript">
    switch (window.location.hash) {
       case '#something':
           $('.class1').addClass('class2')
    }
    </script>

    I'm testing it and looks as it could work. I assume I cannot do this with the JotForm lightbox directly because of cross-domain restrictions, right?

    Thanks,

    David.

  • Profile Image

    Answered by davidvm on May 25, 2017 at 04:37 PM

    Maybe this is a more complete script:

    <script type="text/javascript">
       jQuery(function($){
       switch (window.location.hash) {
           case '#something': $('.class-1').addClass('class-2'); break;
       }
    });
    </script>

    It adds a class-2 to any element with class-1 when opening a url like: mysite.com/#something

  • Profile Image
    JotForm Support

    Answered by Nik_C on May 25, 2017 at 05:30 PM

    Honestly, I'm not sure, I think you should try with regular script embed code since I'm not sure if your code would break the lightbox. 

    Did you test this code, is it working for you?