Forms 2.0: iFrame follow-up script no longer works | Community
Skip to main content
Dan_Stevens_
Level 10
January 29, 2014
Question

Forms 2.0: iFrame follow-up script no longer works

  • January 29, 2014
  • 24 replies
  • 3341 views
Many of our Marketo forms are integrated into our website using iFrames.  Prior to Forms 2.0, we placed a small block of javascript code to enable the follow-up page to load in a full window (instead of within the iframe):

<script type="text/javascript" src="/js/public/jquery-latest.min.js"></script>
<script type="text/javascript">
    // set no conflict mode for jquery
  var $jQ = jQuery.noConflict();

  $jQ(document).ready(function(){
      // all form submits will open in a new window
    $jQ('.lpeRegForm').attr('target','_blank');
  });
</script>

I changed the bold line above to:
$jQ('.mktoForm').attr('target','_blank');
to reflect the new form <div> ID that's being used.  But this still isn't working.  Are there any others in this community that have deployed Forms 2.0 using iFrames and have gotten the follow-up page to open in a full window?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

24 replies

June 23, 2014
Karen,

You are correct, you need to change that bold section and input the Form ID. The form ID can be found in a couple ways, but the way I always do it is to go to the form in Marketo, select it and look at the URL in your browser. You will need to get the number in the URL that follows "FO" and before the next alphabetical letter.

Example:
  • Form url in MKTO: https://app-abb.marketo.com/#FO1237B2
  • Form ID = 1237
Hope this is clear enough.
June 24, 2014
Thank you. This worked great!
August 13, 2014
Thank you to Don for figuring this out!  If it helps anyone out, I added a line of code to figure out the form ID so I can reuse this without inputing the form number each time.  It just pulls it out of the hidden field where it is stored  here it is...

<script> 
  function setupFormSuccess (){
    var formID = $('[name="formid"]').val();
    var form = MktoForms2.getForm(formID);
 
    if(!form){
 setTimeout(setupFormSuccess, 500);
 
    }else{
 
      form.onSuccess(function (values, url){
 
        window.top.location.href = url;
        return false;
 
      });
    }
  }
  setupFormSuccess();
</script>
August 31, 2014
This is great. Is there any way to grab the URL you want the user redirected to from the hidden field values in the form? I don't want to have to edit this script on every landing page but would rather put it in the landing page template and specify the thank-you page when I drop the form on the landing page.

Since the form is now rendered using javascript, I'm not sure how/where to grab this value. When it was an actual hidden field (i.e. <input type="hidden" name="ret" value="url">) it was easy to grab.

Any info/thoughts are much appreciated.

-Damon