How do you add a "Thank You" message upon form completion within a lightbox?

Anonymous
Not applicable

How do you add a "Thank You" message upon form completion within a lightbox?

Hi!

I'm looking for assistance with adding a "Thank You" message upon a form's completion within a lightbox. I do not care to send the user to a separate thank you page upon form completion. Any ideas? I currently have the following:

<!-- LightBox2 -->

<a href="javascript:;" id="lightbox-link2"><img src="http://info.shavlik.com/rs/635-QZI-186/images/Contact-Us-Tile.gif"></a>

          <script src="//app-sji.marketo.com/js/forms2/js/forms2.js"></script>

          <form id="mktoForm_5504"> </form>

          <script>

            var btn = document.getElementById("lightbox-link2");

            btn.onclick = function(){MktoForms2.loadForm("//app-sji.marketo.com", "635-QZI-186", 5504, function (form){MktoForms2.lightbox(form).show();

              });

            };

          </script>

<!-- End LightBox2 -->

Thank you!

-kate (total js noob)

3 REPLIES 3
SanfordWhiteman
Level 10 - Community Moderator

Re: How do you add a "Thank You" message upon form completion within a lightbox?

You want to add a Forms 2.0 onSuccess listener (this isn't specific to lightboxed/unlightboxed).

For example: MktoForms2 :: Thank You HTML​.

Anonymous
Not applicable

Re: How do you add a "Thank You" message upon form completion within a lightbox?

You might find this helpful as it has an example of a form onSuccess handler to show a thank you message: Show Thank You Message Without a Follow-Up Landing Page

Anonymous
Not applicable

Re: How do you add a "Thank You" message upon form completion within a lightbox?

Hi Sanford,

Would you be able to share how you'd add the js onSucess listener you've pointed out to my code above? I'm afraid when I add it on my end, I either get a duplication of the form, or the form doesn't pop up at all.

Here's a temp link to the LP I'm working on: Shavlik

Many thanks!

-kate