Results 1 to 4 of 4

Thread: CoffeeCup Form in LightBox or Layer?

  1. #1
    Join Date
    Dec 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default CoffeeCup Form in LightBox or Layer?

    Hi. I've used CoffeeCup Form Builder to create a nice form for my site and would like to have it open in a lightbox/thickbox, or open in a layer? (If it matters, do have an iFrame on the page, FYI).

    I've got LightBox Gone Wild to work nicely, except it won't load the form. If I open the HTML page (directly) the form works fine.

    This is the code on the HTML page:


    Code:
    <script type="text/javascript" src="swfobject.js"></script>
    <div id="flashcontent"></div>
    <script type="text/javascript">
    var so = new SWFObject("form.swf", "form.xml", "653", "527", "7,0,0,0", "#ffffff");
    so.addParam("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");
    so.addParam("quality", "high");
    so.addParam("scale", "noscale");so.addParam("salign", "lt");
    so.addParam("wmode", "transparent");
    so.addParam("FlashVars", "xmlfile=form.xml&w=653&h=527");
    so.write("flashcontent");</script>
    Thanks in advance.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That's not really a form, it's javascript. The fact that it's javascript that loads up Flash that probably ends up looking and acting like a form isn't as important to getting it to work as imported content as is the fact that it is javascript.

    Of the options listed in your post, Thickbox, using its iframe method would probably have the best chance of working.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2009
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking [RESOLVED] CoffeeCup Form in LightBox or Layer?

    Okay. I used CoffeCup Form Builder for my form and wanted it to open like the examples at their website: http://www.coffeecup.com/form-builder. Having it on the page or in a pop-up was okay, but I like the 'LightBox' effect.

    Anyway, someone did help me and I wanted to share the code in case others can use it. Yep, John, it uses an iframe that opens in a new layer but it's not ThickBox. I could not get that to work and I think this code is a lot lighter. You can probably improve on it and change the size, etc., but it's a start. One thing I'm planing is to use the CSS and JS in an external file rather than in the <head>:

    Code:
    <style type="text/css">
    div#OVERLAY 
    {
        position: absolute; top: 0px; left: 0px;
        width: 100%; height: 1200px; 
        background-color: black;
        -moz-opacity: 0.70; 
        opacity: 0.60; 
        filter: alpha(opacity=70); 
        z-index: 10;
        display: none;
    }
    div#FORMHOLDER
    {
    	position: absolute;
    	top: 0px;
    	left: 0px;
    	width: 100%;
    	background-color: transparent;
    	text-align: center;
    	z-index: 15;
    	display: none;
    	margin: 0px;
    	padding: 0px;
    	right: 0px;
    	bottom: 0px;
    }
    div#FORMHOLDER span.closer
    {
        padding-left: 100px; padding-right: 100px;
        color: #E5BC9D;
        background-color: black;
    }
    div#FORMHOLDER iframe
    {
    	width: 653px;
    	height: 527px;
    	margin: 0px;
    	padding: 0px;
    	background-color: #000;
    }
    </style>
    
    <script type="text/javascript">
    function overshow()
    {    
        var hold = document.getElementById("FORMHOLDER");
        hold.style.display = "block";
        var stop = parseInt(document.body.scrollTop);
        if ( isNaN(stop) ) stop = 0;
        if ( stop == 0 ) 
        {
            var stop = parseInt(document.documentElement.scrollTop);
            if ( isNaN(stop) ) stop = 0;
        }
        hold.style.top = stop + 50 + "px";
        document.getElementById("OVERLAY").style.display = "block";
    }
    function overoff()
    {
        document.getElementById("OVERLAY").style.display = "none";
        document.getElementById("FORMHOLDER").style.display = "none";
    }
    </script>
    Next, use the <div> and an <iframe> tag in the fist line after the <body> tag:

    Code:
    <div id="OVERLAY"></div>
    <div id="FORMHOLDER">
       <span class="closer" onclick="overoff()">Click here to close</span><br />
       <iframe src="form.html" scrolling="no" frameborder="0"></iframe>
       <br /><span class="closer" onclick="overoff()">Click here to close</span>
    </div>
    Finally, when you link to the form page CoffeeCup creates, the code is:

    Code:
    <a href="#" onclick="overshow(); return false;">link</a>
    I hope this is useful to some of you. I looked long and hard and could find nothing so... Cheers!

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That means that it would also work with Thickbox. But only with Thickbox's iframe method, it has several.

    But, if it is working for you as you have it, that's great!
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •