AnsweredAssumed Answered

Hiding form after fillout on RTP popup - Murtza?

Question asked by Dory Viscogliosi on Jan 30, 2015
Latest reply on Feb 2, 2015 by Dory Viscogliosi
I'm sure that more people than just Murtza could answer this, but I've been going through the developers documentation to hide a form after successful submission, and either I'm adding the code to the wrong location, or it isn't working with the updated asynchronous code that support recommended for adding a forms 2.0 form to an RTP popup. 

The code recommended by support was:

<form id="mktoForm_1589"></form>
<script type="text/javascript">// <![CDATA[
$.ajax({ 
cache: true, 
async: true, 
url: "//app-sj05.marketo.com/js/forms2/js/forms2.js", 
dataType: "script", 
success: function(){ 
MktoForms2.loadForm("//app-sj05.marketo.com", "867-SLG-901", 1589); 

});
// ]]></script>

The code to hide the form upon submission is: 
 
  1. MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form){
  2. //Add an onSuccess handler
  3. form.onSuccess(function(values, followUpUrl){
  4. //get the form's jQuery element and hide it
  5. form.getFormElem().hide();
  6. //return false to prevent the submission handler from taking the lead to the follow up url.
  7. return false;
  8. });
  9. });
Can anyone point me in the right direction of putting hose two together so that they hide the form upon submission? Thank you so much in advance!

Outcomes