On form submit, replace form with "thank you" message | Community
Skip to main content
May 23, 2014
Question

On form submit, replace form with "thank you" message

  • May 23, 2014
  • 14 replies
  • 6053 views
Is there a way to do this without bringing a second landing page into the equation, as suggested by this post:

https://community.marketo.com/MarketoDiscussionDetail?id=90650000000PSMjAAO

I've come across some steps for getting at the form's embed text to make the form "disappear" on submit:

http://developers.marketo.com/documentation/websites/forms-2-0/

But when I followed these steps, I was unable to edit the embed code in Marketo, and wasn't sure where to copy and paste that code without affecting the functionality currently in place (in other words, I don't want to break the basic form functionality).

Inside my index.html file, I have the following JS:

    <script type="text/javascript">
      function formSubmit(elt) {
        var formSubmit = Mkto.formSubmit(elt);
        if (!formSubmit) {
          jQuery('span.mktFormSubmitError').show();
          return false;
        }
        return true;
      }
      function formReset(elt) {
        return Mkto.formReset(elt);
      }
    </script>

Which is used as an event handler when the Submit button is clicked:

<a onclick='formSubmit(document.getElementById("mktForm_1024")); return false;' href="#" class="button">SUBMIT</a>

Could the answer lie in making changes to the code inside the above script tag, or is there another way I should go about this? What about jQuery's .load() method?
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

14 replies

April 2, 2015
Hi Derek - I realize this topic is old but hoping you are still subscribed to these posts. I found your previous reply helpful. Do you know how I could get the confirmation div to disappear after X amount of time (in my particular case I want to keep the form visible at all times and have the confirmation show up after submission for a few seconds, then disappear)? Thanks in advance!

 
Matt_Stone2
Level 9
April 2, 2015
I would check out this thread for options on hiding the div after a few seconds: http://stackoverflow.com/questions/820951/hide-div-after-a-few-seconds -- you would just start out with showing it first, then exectue the script in that link to hide it after a few seconds.
Robb_Barrett
Level 10
November 2, 2015

Hi all -

Sorry for necroposting, but I've been using this functionality on my page but it's not prefilling the form. Is there a setting I need to add to get the pre-fill? The page has it enabled.

Robb Barrett
Matt_Stone2
Level 9
November 2, 2015

If you're using the form javascript snippets, you won't be able to use prefill. It's a security restriction for transferring data off Marketo.

SanfordWhiteman
Level 10
November 2, 2015

Forms 2.0 JS works fine on Marketo LPs. The prefill restriction is for non-Marketo LPs.

Robb_Barrett
Level 10
November 9, 2015

I'm not getting pre-fill on my Marketo LPs.

Robb Barrett