SOLVED

Form Prefill Functionality is not working in embed form

Go to solution
Anonymous
Not applicable

Hi

I have used the embed code of the form in the marketo LP and to prefill the form I am using rest API's of the marketo but I am getting the error " No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin is therefore not allowed access.".

Please let me know if anyone has solved this type of problem.

1 ACCEPTED SOLUTION
SanfordWhiteman
Level 10 - Community Moderator

I have used the embed code of the form in the marketo LP and to prefill the form I am using rest API's of the marketo but I am getting the error " No 'Access-Control-Allow-Origin' header is present on the requested resource.

Never, ever, ever even think about exposing the REST API directly from a webpage.  The security and reliability consequences are absurd.  Honestly, you should shut down your web presence before considering this.

In your case, there's no need to consider this.  If it's a Marketo LP using the embed code instead of a named Form element (not advisable, but you can do it if you insist) then you can for the most part fill the form using tokens:

MktoForms2.whenReady(function(form){

  form.setValues({

    LastName : "{{Lead.Last Name}}"

  });

});

Also be aware that multiple Marketo forms with the same ID on the same page have subtle problems (yes, even if one of them is set to display: none;). You can check some of my posts here for pointers.

View solution in original post

26 REPLIES 26