AnsweredAssumed Answered

Prevent Lead/Contact Creation on Landing Page Form Submission?

Question asked by Gareth Bromser on May 16, 2019
Latest reply on May 16, 2019 by Sanford Whiteman



Within a Marketo landing page, that uses a form, I am using the form API's onSubmit() method to make an external POST call to a remote endpoint when the form is submitted.  Works well.


When the form is submitted this of course also triggers creation of a lead in the Marketo database.  Is there any way to prevent this from happening?  So that the form can still be submitted, run the script tied to onSubmit(), but not actually create a new lead in Marketo.


The code I am adding to the LP (with a <script> tag) is below.  Anything I can add here that would achieve the above and prevent Marketo lead creation?  I thought maybe returning immediately after the API call might do it, but no luck.  Thank you!!


async function sendFormData() {
   MktoForms2.whenReady(function(form) {
      form.onSubmit(async function() {
         const vals = form.vals();

         const valsToSend = {
            Source: 'marketoLp',

         const valsToSendJson = JSON.stringify(valsToSend);

         await fetch(REMOTE_API_URL, {
            method: 'POST',
            headers: {
               'Content-Type': 'application/json',
            body: valsToSendJson,

      return null;