Show Thank You Message Without a Follow-Up Landing Page | Community
Skip to main content
September 23, 2016
Solved

Show Thank You Message Without a Follow-Up Landing Page

  • September 23, 2016
  • 2 replies
  • 7236 views

Hello,

We are using Marketo forms embedded on our external website. We have followed the instructions from the developer tools on how to use JavaScript to have a confirmation message appear after the form is completed, rather than lead to an separate landing page. (Instructions: http://developers.marketo.com/blog/show-thank-you-message-without-a-follow-up-landing-page/ ) These confirmations are working correctly for individual form fill-outs with no issue.

However, we have a newsletter subscription form that is permanently in the footer of our website. We have noticed that on pages where our resource download forms exist, the confirmation appears on the resource form after completion, as well as subscription form at the bottom.

Does anyone know what we have to edit in our JavaScript to make sure that the confirmation only appears for that specifically identified form?

Thank you!!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

Yes, that code adds the listener to all Marketo forms, so any form that was successfully submitted gets the Thank You message.

To address only specific forms, you can adapt the code like this:

MktoForms2.whenReady(function (form){

  var samePageTYForms = [122,222,656];

  if ( samePageTYForms.indexOf(form.getId()) != -1 ) {

     form.onSuccess(function(values, followUpUrl){

       // rest of listener code omitted for brevity

     });

  }

});

Where samePageTYForms is an array of the form IDs for which you want to use same-page Thank You.  Any other forms will be ignored.

You might also check the method on my post http://blog.teknkl.com/same-page-thank-you-text-with-marketo-forms-about-the-aliid/ which I (naturally!) find more flexible.

2 replies

Benjamin_Ortiz1
New Participant
October 3, 2016

Is there a way to do this using the guided landing pages?

Grégoire_Miche2
New Participant
October 3, 2016

Yes, you just need to add the script at the end of the landing page or it's template.

<script>

MktoForms2.whenReady(function (form) {

  var samePageTYForms = [122,222,656];

  if ( samePageTYForms.indexOf(form.getId()) != -1 ) {

    form.onSuccess(function(values, followUpUrl){

      // rest of listener code omitted for brevity

    });

  }

});

</script>

-Greg

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
September 23, 2016

Yes, that code adds the listener to all Marketo forms, so any form that was successfully submitted gets the Thank You message.

To address only specific forms, you can adapt the code like this:

MktoForms2.whenReady(function (form){

  var samePageTYForms = [122,222,656];

  if ( samePageTYForms.indexOf(form.getId()) != -1 ) {

     form.onSuccess(function(values, followUpUrl){

       // rest of listener code omitted for brevity

     });

  }

});

Where samePageTYForms is an array of the form IDs for which you want to use same-page Thank You.  Any other forms will be ignored.

You might also check the method on my post http://blog.teknkl.com/same-page-thank-you-text-with-marketo-forms-about-the-aliid/ which I (naturally!) find more flexible.

September 23, 2016

This worked perfectly - thanks so much Sanford!

September 24, 2016

Thanks Sanford, this is cool!