SOLVED

Re: Embed form prefill

Go to solution
chintalapudi4
Level 1

Embed form prefill

Hello,

 

We're embedding the Marketo forms on our Website and would like to prefill the form for returned/known users. Whats your recommendation for embed form prefill on external site (not on Marketo Landing pages)?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Embed form prefill

Sandy's prefill solution is the way to go. Here's the link to his blog post where he has explained his form prefill method in detail.

 

View solution in original post

3 REPLIES 3
Darshil_Shah1
Level 10 - Community Advisor + Adobe Champion

Re: Embed form prefill

Sandy's prefill solution is the way to go. Here's the link to his blog post where he has explained his form prefill method in detail.

 

Anna_Blanchet1
Level 4

Re: Embed form prefill

Hi!
I'm working with one of our developers to implement @SanfordWhiteman 's prefill solution and we've run into an issue. The developer does not have access to Community so I'm posting as a proxy. Any help would be appreciated!

------

I followed the instructions closely from the post and am using the updated SimpleDTO2, but have been running into issues. 

 

I set up a Guided Landing page and have the associated DTO with the configured html. However, when I open a Marketo form from the destination site I receive the following error: “Message receive preflight failed, origin: https://uat.example.com and https://pages.e.example.com cannot exchange messages. I realize this is a CORS error but if I visit https://pages.e.example.com directly it re-routes me to another page, so I am unable to set the Headers on that page to allow the origin request.   (https://pages.e.example.com is the Marketo landing page CNAME)

 

Following the instructions in the blog post, I would not expect a CORs error to be occurring. I was hoping you might have an on what I could be doing wrong or potential workarounds I could try? I am not able to create a proxy server to get around CORs. 

 

The configuration I have on my receiving site is below (the teknkl-formsplus-core-1.0.8.js and teknkl-simpledto-2.0.4.js script files both are set in a CDN and appear to be loading correctly):

 

 

  const DTO = new SimpleDTO({
          debug: true,
          mode: 'receive',
          transport: 'message',
          messageSource: 'https://pages.e.example.com',
          messageTarget: ['https://uat.example.com'],
          dataSrc: 'https://pages.e.example.com/dtp-104.html',
          cb: function (instance: any, mktoFields: any) {
            MktoForms2.whenReady(function (form: { setValuesCoerced: (arg0: any) => void }) {
              form.setValuesCoerced(mktoFields);
            });
            DTO.cleanup();
          },
        });
 
And then in my Marketo instance I have:
 
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <title>DTP</title>
    <script
      id="teknkl-FormsPlus-Core-1.x"
      src=“https://path_to_CDN_stored/teknkl-formsplus-core-1.0.8.js"
    ></script>
    <script
      id="teknkl-SimpleDTO-2.x"
      src=“https://path_to_CDN_stored/teknkl-simpledto-2.0.4.js"
    ></script>
    <script
      type="text/xml"
      class="dto-xml"
      data-field-collection="mktoPreFillFields_01"
    >
      <mktoPreFillFields>
       <mktoField inputName="FirstName">{{Lead.First Name}}</mktoField>
       <mktoField inputName="LastName">{{Lead.Last Name}}</mktoField>
       <mktoField inputName="Email"><!--email_off-->{{Lead.Email Address}}<!--/email_off--></mktoField>
       <mktoField inputName="Country">{{Lead.Country}}</mktoField>
       <mktoField inputName="State">{{Lead.State}}</mktoField>
       <mktoField inputName="Title">{{Lead.Job Title}}</mktoField>
       <mktoField inputName="Industry">{{Company.Industry}}</mktoField>
       <mktoField inputName="Company">{{Company.Company Name}}</mktoField>
       <mktoField inputName="Company">{{Lead.Marketing Consent Date}}</mktoField>
       <mktoField inputName="Company">{{Lead.Marketing Consent Reason}}</mktoField>
      </mktoPreFillFields>
    </script>
    <script>
      var DTO = new SimpleDTO({
        debug: true,
        mode: "send",
        transport: "message",
        messageSource: " https://pages.e.example.com",
        messageTarget: ["https://uat.example.com"],
        dataSrc: "https://pages.e.example.com/dtp-104.html",
      });
      DTO.parse("mktoPreFillFields_01");
    </script>
  </head>
  <body></body>
</html>

 

 

 

SanfordWhiteman
Level 10 - Community Moderator

Re: Embed form prefill

No CORS headers are necessary for SimpleDTO. Would need to look at the actual page to troubleshoot further.

 

P.S. If you’re supplying what’s supposed to be a placeholder domain, please use the standard example.com! I edited your post for clarity.