How do I get the form to open when someone clicks an image vs a link?

  • Profile Image
    jamaciaj08
    Asked on October 21, 2011 at 12:53 PM

    I need to know how to modify the code to get a form to open when the user clicks an image instead of a link. I would like it to open using the lightbox format.

  • Profile Image
    liyam
    Answered on October 21, 2011 at 04:03 PM

    To be able to use an image as your link for your lightbox, simply get the lightbox code from your form:

    1. Edit your form
    2. Click Embed Form
    3. Select Lightbox
    4. Get the code and place it on your web page.

    Here's a sample lightbox script:

    <script src="//www.jotform.com/min/g=feedback" type="text/javascript">
    new JotformFeedback({
    formId:'11814245193',
    base:'http://www.jotform.com/',
    windowTitle:'Test Form',
    background:'#FFA500',
    fontColor:'#FFFFFF',
    type:1,
    height:500,
    width:700
    });
    </script>
    <a class="lightbox-11814245193" style="cursor:pointer;color:blue;text-decoration:underline;">Sample Contact with confirmation page and send post data</a>

    Once you have already placed the code on your web page, simply find the URL of the image that you wish to use. 

    example: http://spiritquestors.zzl.org/jotform/images/pdf.jpg

    Then, replace the text inside the lightbox link.  Please refer to the sample text that you will have to replace in the script above (the text in bold and enclosed with <a class="... > and </a> tags).

    Here's a sample image code:

    <img src="//spiritquestors.zzl.org/jotform/images/pdf.jpg" border="0">

    Here is a sample completed script:

    <script src="//www.jotform.com/min/g=feedback" type="text/javascript">
    new JotformFeedback({
    formId:'11814245193',
    base:'http://www.jotform.com/',
    windowTitle:'Test Form',
    background:'#FFA500',
    fontColor:'#FFFFFF',
    type:1,
    height:500,
    width:700
    });
    </script>
    <a class="lightbox-11814245193" style="cursor:pointer;color:blue;text-decoration:underline;"><img src="//spiritquestors.zzl.org/jotform/images/pdf.jpg" border="0"></a>

    Once you have replaced the text with an image source, you will have a clickable image that will show a lightbox once clicked.

    Here is the sample working script:

    If you need further clarification regarding this matter, please let us know.