Global Form Script Issues

Reanna_Pelkey
Level 2

Global Form Script Issues

Hi there,

I'm attempting to switch our content forms to 1 global form (on non-marketo pages) but I'm running into issues when it comes to getting the correct PDF to open. The goal is for each content landing page to use the global form and then upon hitting the 'submit' button the PDF for that content downloads. They do not go to a different landing page or get sent an email.

I know how to add the code for the global form but how do I get the correct PDF to download?

Thank you!

3 REPLIES 3
Jim_Thao7
Level 9

Re: Global Form Script Issues

You won't be able to do this with anything out of the box in Marketo that I know about.  This requires a custom setup/process.

The use case of the need to direct a person to a unique asset on form submission means a global form may not be the best for you, completely IMO.

However, to answer your question, I would probably create a custom script to fire off upon form submission and evaluate against a UTM parameter (clearly defining the UTM and mapping it to what asset should be served up).

SanfordWhiteman
Level 10 - Community Moderator

Re: Global Form Script Issues

Well, your task is clear: the page that hosts the form needs to know the URL of the related PDF!

Whether that URL is supplied as a query param (as Jim suggests) or perhaps is supplied via a page variable set up in your CMS (for example, a WordPress site can have a page type that requires the page author to supply a string variable) is up to you.  The end goal is the same.

For a UTM param mapped to the field lastAssetURL in Form Editor:

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,thankYouURL){

    var currentValues = form.getValues();

    document.location.href = currentValues.lastAssetURL;

    return false;

  });

});

For a page variable set using some other method:

var currentAssetURL = Your_WP_Variables.assetURL;

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,thankYouURL){

    document.location.href = currentAssetURL;

    return false;

  });

});

Reanna_Pelkey
Level 2

Re: Global Form Script Issues

Awesome stuff, we were able to use what you provided and get over to a global form. Thank you!