Confirmation upon form submission (while staying on same page)? | Community
Skip to main content
August 3, 2015
Solved

Confirmation upon form submission (while staying on same page)?

  • August 3, 2015
  • 1 reply
  • 6495 views

Hi all!

I have embedded a form on our website. When the form is filled out, I'd like for the user to stay on that same page, but know that their form submission was successful. Any ideas on how to create a confirmation without navigating away from the page? I'm thinking either 1) change the button text after submission (for example, "thank you!), 2) have a popup confirmation window, or 3) disallow another form fillout.

Thanks,

Samantha

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

Of course!  There are many ways to work with the same page + form after submission. The key is to return false; from the onSuccess listener.

One of many examples here: MktoForms2 :: Thank You HTML

You should also search for my name and "form" in the Community.  There are almost 100 posts + many demos!

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
August 3, 2015

Of course!  There are many ways to work with the same page + form after submission. The key is to return false; from the onSuccess listener.

One of many examples here: MktoForms2 :: Thank You HTML

You should also search for my name and "form" in the Community.  There are almost 100 posts + many demos!

August 4, 2015

Thanks so much Sanford! Great example & very easy to use. I got it working on your link, but it shows up as blank when I try to embed it. Any thoughts on why the following isn't working? I only have basic knowledge about coding, so thanks so much for your help!

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

<form id="mktoForm_1262"></form>

<script>

MktoForms2.loadForm("//app-abk.marketo.com", "958-YXI-045", 1262,

  function(form) {

  var formEl = form.getFormElem()[0];

  form.onSuccess(function(vals, thankYouURL) {

  var thanksEl = document.createElement('DIV');

  thanksEl.innerHTML = 'Thank you for your submission.';

  formEl.parentNode.replaceChild(thanksEl, formEl);

  return false;

  });

  });

</script>

UPDATE: @Sanford Whiteman​

I've been looking around and actually prefer a popup box on submit. I'm wondering if it's just the software that I'm trying to embed it on, or if the coding is wrong:

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

<form id="mktoForm_1262"></form>

<script>

MktoForms2.loadForm("//app-abk.marketo.com", "958-YXI-045", 1262,

  function(form) {

  1. form.onSubmit(function(){

alert("Thanks for signing up. We’ll add your Knovio + SAVO Inspire integration shortly!");

        });

      });

    </script>

SanfordWhiteman
New Participant
August 4, 2015

Isn't blank for me: nation.marketo.com/thread/26193