Trying to send message using Freeform Pro in a lightbox (Fancybox). I'd like to have confirmation message display inside of lightbox after successful submit. Not quite sure the best way to accomplish this. Any insight or advise?
1 Answer
If you want the thank you message to appear in the same Lightbox window as the form, without a refresh, you'll need to do this with Ajax. This is the basic outline of how this would happen:
- Create a Thank You page in the CMS with your content.
- Create your Freeform form and put it in the Lightbox. I'm assuming it's invoked by clicking a link on the containing page? Wrap the whole form (all the content you want to replace) with a div class="ajax-content" (or whatever you want to call it).
- Give your submit button a class like "get-thank-you" and create an onclick event for this button that replaces ajax-content with data from the thank you url. You can find an example of how to do this here: https://stackoverflow.com/a/13832977/990061
Hope this makes sense?