Re: Form not pre-filling reliably

SanfordWhiteman
Level 10 - Community Moderator

Re: Form not pre-filling reliably

Also, if you only care about the email address you can just pass it in the URL.

On the first page:

MktoForms2.whenReady(function(form){

  form.onSuccess(function(vals,tyUrl){

    var tyLoc = document.createElement("a");

    tyLoc.href = tyUrl;

    tyLoc.hash = encodeURIComponent(vals.Email);

    document.location = tyLoc;

    return false;

  });

});

On the second page:

MktoForms2.whenReady(function(form){
  form.setValues({

    Email : decodeURIComponent(document.location.hash.substring(1))

  });

});

Kai_Crow2
Level 2

Re: Form not pre-filling reliably

That's a tidy solution! Yes, that will work

Kai_Crow2
Level 2

Re: Form not pre-filling reliably

Just double checked - it's definitely set to follow up with landing page:

Screen Shot 2018-06-22 at 3.14.49 PM.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Form not pre-filling reliably

Maybe the form descriptor is corrupt and that's why you aren't getting the aliId now -- but that for sure would cover you, it's pretty much designed for this case.

Kai_Crow2
Level 2

Re: Form not pre-filling reliably

Thanks again Sanford - I'm going to go ahead and update to pass email via the URL parameter as you suggest. Definitely owe you a beer if I ever happen to make it to Marketing Nation!

I wondered if it might be due to having two embedded forms on the page that the form wasn't behaving as expected, but have tried removing the other embedded form and didn't make any difference.

SanfordWhiteman
Level 10 - Community Moderator

Re: Form not pre-filling reliably

Thanks again Sanford - I'm going to go ahead and update to pass email via the URL parameter as you suggest. Definitely owe you a beer if I ever happen to make it to Marketing Nation!

Sounds good!

It wouldn't be the 2 forms. I think the form must be corrupt (which happens, albeit very rarely) and isn't remembering that you're using a named LP. You should be getting the ​aliId attached automatically.

Maria_Hirschbe1
Level 2

Re: Form not pre-filling reliably

Hello Sanford Whiteman,

We ran into a similar problem and were wondering if you could help.

We have a simple Marketo form with an email address field and a hidden checkbox field with the default value = “True”. After this form is submitted, the person is redirected to another Marketo LP with a form on which this checkbox field is visible and should be selected, and the email address should be pre-populated too. We noticed that sometimes the checkbox is not selected, but the email address is populated. We have the aliId in the url when the person is redirected to the second Marketo page.

How can we pass the hidden value “True” for a field from the first to the second Marketo form?

Thank you

Maria

SanfordWhiteman
Level 10 - Community Moderator

Re: Form not pre-filling reliably

What is/are the URLs here?

Maria_Hirschbe1
Level 2

Re: Form not pre-filling reliably

Hi Sanford,

Here is the url: http://go.bain.com/test-email-address-form-1.html

We expect the "Bain Insights newsletter" to be selected on the second page.

SanfordWhiteman
Level 10 - Community Moderator

Re: Form not pre-filling reliably

The value should be "yes" (lowercase) actually, not "True" -- that's the canonical way that Booleans are represented on Marketo forms. so when you have a Hidden field (which is a freeform string) it should use the same values.