SOLVED

Form on a RTP Dialog Web Personalization - success message issues

Go to solution
Kevin_Stinson
Level 3

Form on a RTP Dialog Web Personalization - success message issues

Hello

We have a form on a RTP Dialog Web Personalization. The form is set to "Stay on page".
What we are trying to do is once the form is submitted have a success message replace the form and the page not to refresh.
We have the page displaying the success message initially but the page refreshes so quickly that the user really does not have time to see the message.

When the page refreshes we also get the URL with this extra parameter that breaks/errors the page I assume because of some server setting that then does not allow this parameter.
?aliId=eyJpIjoiTkZIam9TaHptdWFtZE5ReCIsInQiOiJwN2R4Wjd4OEFJWW9cL1dEcHB5cm5ndz09In0%253D&iesrc=ctr

 

See code that we are using:

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script src="//pages.to.xyz.com/js/forms2/js/forms2.min.js"></script>
<div class="form-container"><form id="mktoForm_6739">
<h2>Recession Recovery: Stay Ready with Our Economic Updates</h2>
<br /><br /></form></div>
<script>
MktoForms2.loadForm("//pages.to.xyz.com", "848-IAP-939", 6739);
MktoForms2.whenReady(function (form){

  //Add an onSuccess handler

   form.onSuccess(function(values, followUpUrl){

    //get the form's jQuery element and hide it

    form.getFormElem().hide();

    document.getElementById('confirmform').style.visibility = 'visible';

    //return false to prevent the submission handler from taking the lead to the follow up url.

    return false;

  });

});

</script>
<div id="confirmform" style="visibility: hidden;">
<p><strong>Thank you we have received your request.</strong></p>
</div>
</body>
</html>

 

1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor

Re: Form on a RTP Dialog Web Personalization - success message issues

Hi @Kevin_Stinson

 

Can you try setting the do not redirect flag on the form object to true? Add the below line of code in the whenready function.

 

form.doNotRedirect = true; 

 

View solution in original post

2 REPLIES 2
Darshil_Shah1
Level 10 - Community Advisor

Re: Form on a RTP Dialog Web Personalization - success message issues

Hi @Kevin_Stinson

 

Can you try setting the do not redirect flag on the form object to true? Add the below line of code in the whenready function.

 

form.doNotRedirect = true; 

 

Kevin_Stinson
Level 3

Re: Form on a RTP Dialog Web Personalization - success message issues

Thanks Darshil that worked.