Ideas to knowledge form submission, then refresh form after a delay? | Community
Skip to main content
April 2, 2015
Solved

Ideas to knowledge form submission, then refresh form after a delay?

  • April 2, 2015
  • 4 replies
  • 1559 views
I'm creating a landing page with Marketo form embedded and this will be used at a tradeshow. I want people to fill out the form, receive some sort of aknowledgement (like text that says thank you and disappears after a few seconds), and then for the form to be refreshed (actually probably makes more sense for the form to refresh, and then thank you text to appear). 

Does anyone know how to implement this or have other ideas?

I've figured out how to get a Thank you text to show with the submission, but then the form refreshes right away so I only see the message for a quick flash.

I used an idea found on another thread. Here's my code:

<script src="//app-sjg.marketo.com/js/forms2/js/forms2.js"></script>
<form id="mktoForm_XXXX"></form>
<script>MktoForms2.loadForm("//app-sji.marketo.com", "nnn-nnn-nnn", XXXX, function(form){
  //Add an onSuccess handler
  form.onSuccess(function(values, followUpUrl){
  document.getElementById('confirmform').style.visibility = 'visible';
});});</script>
 <div id="confirmform" style="visibility:hidden;"><p><strong>Thank you.</strong>.</p></div>          
 
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
function(form){
  form.onSuccess(function(values, followUpUrl){
      document.getElementById('confirmform').style.visibility = 'visible';
      setTimeout(function(){document.location.href = followUpUrl},4000);
      return false;
    });
 });

4 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
April 2, 2015
function(form){
  form.onSuccess(function(values, followUpUrl){
      document.getElementById('confirmform').style.visibility = 'visible';
      setTimeout(function(){document.location.href = followUpUrl},4000);
      return false;
    });
 });
April 6, 2015
Thanks Sanford. I tried a variation of that but I think I had some syntax wrong. Anyways, thanks again! That worked.
April 8, 2015
Sanford - do you happen to know - My message shows up fine, but actually shows up on top of the submit button, so I added 2 BR tags within my DIV tag where the confirmation message is. However, the breaks show all the time, so there's a big gap of padding at the bottom of my form.

Any idea on how to fix this? I tried throwing the form in a table and the message in a new row, but that didn't work.
SanfordWhiteman
Level 10
April 9, 2015
I would have to see the HTML (i.e. URL) of your page to know exactly what you're talking about.