Marketo Forms pre-fill when there are two forms in the same page | Community
Skip to main content
Ravindranathsa2
Level 2
Apr 30, 2019 5:10 AM UTC
Solved

Marketo Forms pre-fill when there are two forms in the same page

We have two Marketo forms in a single page and display of forms will be controlled based on mktoPreFillFields, something like this

MktoForms2.whenReady(function (form){

if(typeof mktoPreFillFields != "undefined" && !jQuery.isEmptyObject(mktoPreFillFields)){

/* Show form2 and hide form 1 */

}

}

With the new Marketo Form Pre-fill Feature upgrade​ we had to use Sanford Whiteman's solution for Pre-fill of forms. Unfortunately Pre-fill of forms is happening after the above function is executed and only form1 is getting displayed every time. As there are two MktoForms2.whenReady() functions , is there a way to control the flow between the two like pre-fill executes first and then the above one?

Any suggestions are welcome. Thanks in advance!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Apr 30, 2019 5:35 AM UTC

The TEKNKL Pre-Fill library doesn't overwrite window.mktoPreFillFields. It uses a JS object that exists only inside the cb (callback) function.

Add your code above inside the cb if you want it to depend on the contents of mktoFields.

2 replies

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
Apr 30, 2019 5:35 AM UTC

The TEKNKL Pre-Fill library doesn't overwrite window.mktoPreFillFields. It uses a JS object that exists only inside the cb (callback) function.

Add your code above inside the cb if you want it to depend on the contents of mktoFields.

Translate
Ravindranathsa2
Level 2
Apr 30, 2019 8:17 AM UTC

Thanks for the quick response Sanford. I have assigned values to mktoPreFillFields and then things worked as expected.

Translate