form submit to _blank | Community
Skip to main content
Colby_Dix
New Participant
August 26, 2014
Solved

form submit to _blank

  • August 26, 2014
  • 13 replies
  • 4384 views

So I have a landing page that's a rather simple form that i am embedding into an iframe within a wordpress post. it looks good.

When you hit 'submit' it triggers an automatic link to a pdf, which unfortunately opens up in the iframe. that doesn't look good. 

Any advice I've tried to find on this has broken links or no info on the jquery code necessary. Any help is appreciated!

Colby

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 Colby_Dix

I figured it out, sort of. The key is to put this into the html window:

<base target="_blank" />


And then , boom, it's working in chrome at least. Not working reliably in IE...
 

13 replies

Colby_Dix
Colby_DixAuthor
New Participant
September 2, 2014

Hey Murtza,

the self tag works in no browsers at all, while blank works in all of the good ones and not IE.

 

Gary, I'm pretty sure I'm going to go down that path. I'd rather pay a little something for a plugin that works reliably than spending countless hours guessing and trying to fix what marketo hasn't bothered to and apparently won't bother to.

ooooh shiny.
August 29, 2014
If you don't want to code... you owe it to yourself to look at the WP Plug-in for Marketo from Gravity Forms.  
http://wordpress.org/plugins/marketo/

Very flexible for making your forms integrate into your WP Themes -- and I have found that they reliably trigger Marketo Smart Campaigns.

August 29, 2014
Awesome. I am happy you were able to get it to work!

For IE, try:
<base target="_self"/>
 
Colby_Dix
Colby_DixAuthorAccepted solution
New Participant
August 28, 2014

I figured it out, sort of. The key is to put this into the html window:

<base target="_blank" />


And then , boom, it's working in chrome at least. Not working reliably in IE...
 

ooooh shiny.
August 26, 2014
I am not sure, so I will let somebody else comment here. I'll update this comment if I can think of anything else.
Colby_Dix
Colby_DixAuthor
New Participant
August 26, 2014

still no. i feel like i must be missing something simple. to recap, I have a simple landing page with just a form and a small blurb of html that holds ONLY the javascript that we are trying. those are the only two elements for the LP. it uses form 1090, but the redirect after hitting submit always comes from the form settings and is not affected by the javascript at all. i know this as i set the form submit to go to an external page (google) and it goes there regardless of what's in the javascript.

does the html box need to be positioned somewhere specific for the java to take over the built in forms submit function?

ooooh shiny.
August 26, 2014
Ok. Let's keep trying. Try this:

<script> 
 
  function setupFormSuccess (){
 
    var form = MktoForms2.getForm(1090);
 
    if(!form){
 
      setTimeout(setupFormSuccess, 500);
 
    }else{
 
      form.onSuccess(function (values, followUpUrl){
 
        window.top.location.href = "http://example.com/example.pdf";
 
        return false;
 
      });
 
    }
 
  }
  setupFormSuccess();
</script>
Colby_Dix
Colby_DixAuthor
New Participant
August 26, 2014
still not working... hmmm.

i also tried using only "top.location.href" , still to no avail...
ooooh shiny.
August 26, 2014
Almost there. Made a change that should make it work. Try the code below (you will just need to change example.com/example.pdf to the link to your pdf, but keep same structure).

Let me know if it works? 

<script> 
 
  function setupFormSuccess (){
 
    var form = MktoForms2.getForm(1090);
 
    if(!form){
 
      setTimeout(setupFormSuccess, 500);
 
    }else{
 
      form.onSuccess(function (values, url){
 
        window.top.location.href = "http://example.com/example.pdf";
 
        return false;
 
      });
 
    }
 
  }
  setupFormSuccess();
</script>

Colby_Dix
Colby_DixAuthor
New Participant
August 26, 2014

based on my findings here:

https://community.marketo.com/MarketoDiscussionDetail?id=90650000000PlLWAA0


I tried adding this in an html block on the landing page to no avail (the form utilized in this instance is 1090):
 

<script> 
 
  function setupFormSuccess (){
 
    var form = MktoForms2.getForm(1090);
 
    if(!form){
 
      setTimeout(setupFormSuccess, 500);
 
    }else{
 
      form.onSuccess(function (values, url){
 
        window.top.location.href = url;
 
        return false;
 
      });
 
    }
 
  }
  setupFormSuccess();
</script>

the blog post with the form exists here:

https://community.marketo.com/MarketoDiscussionDetail?id=90650000000PlLWAA0

ooooh shiny.