Marketo Forms pre-fill when there are two forms in the same page | Community
Skip to main content
Ravindranathsa2
New Participant
April 30, 2019
Solved

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

  • April 30, 2019
  • 1 reply
  • 2102 views

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.
Best answer by SanfordWhiteman

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.

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
April 30, 2019

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.

Ravindranathsa2
New Participant
April 30, 2019

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