• Resolved Sue

    (@bunster101)


    I have Easy Fancybox set up to display an iframe automatically when the page loads. Within that iframe content is a form for them to subscribe.

    The form directs to another page on success, but the page is displaying in the iframe. I want the iframe to submit the data, then close the iframe and then display the new page without being in the iframe.

    Do you think that it is possible?

    http://wordpress.org/extend/plugins/easy-fancybox/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Sue

    (@bunster101)

    Here’s the button code I am working with:

    <input type="hidden" name="SuccessURL" value="http://www.mydomain.com/thankyou-page-example" />
    <input id="signup" type="submit" name="signup" value="Send" />

    Hi, it should be possible but how depends on your form setup…

    It may be the easiest to add a so called ‘break-out script’ on that success page. See below for instructions.

    If that is not possible, you might be able to use the function parent.$.fancybox.close();return true; on onsubmit/onclick to close the FancyBox iframe. But it will also make the the form break out if the box on submit fail. Note: this will only work if the iframe content (form) and the parent page are hosted on the same domain. Read more on http://fancybox.net/api

    Break-out script instructions

    Use this inside the success page:

    <script type="text/javascript">
    this.top.location !== this.location && (this.top.location = this.location);
    </script>

    (credits: http://css-tricks.com/snippets/javascript/break-out-of-iframe/)

    If it’s an external page that you have access to, it’s easy. Simply add the snippet anywhere in the head section. But if the success page an external page you do not have modifying access to, it’s not possible.

    If it’s a WordPress page, it might be difficult because you do not want the script to be in every other page on your site, preventing you from displaying the initial form in the iframe. To do this, you might use a plugin like Widget Logic and put the script into a text widget and add a rule that says something like

    is_single('thankyou-page-example')

    (note: ‘thankyou-page-example’ should correspond with the actual success page slug) into the Widget Logic field.

    Thread Starter Sue

    (@bunster101)

    Thank you!

    I will go the simpler route that you suggested.

    I just created a new external Success page and had it say Thank you! Here is your link for your free gift.

    That new page won’t be in WordPress – but my opt-in content isn’t in WordPress either. I’ve been down so many rabbit holes with this I cannot remember why I made it an external page but there was a reason 🙂

    I’ll put a bit of styling on it and you have solved my headache!

    Your plugin is wonderful and your support is fantastic.

    As an FYI, this is a work around for Constant Contact’s sign up process just not playing nice with my WordPress site. Constant Contact WordPress Plug in for Gravity Form has limitations so I needed to figure out a different way to accomplish what I want. Sweet!

    Thanks again.

    Sue

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Easy FancyBox – Submit Form Data and Close iFrame’ is closed to new replies.