Overriding or Disabling Marketo Form Validation

Version 3

    Warning: This isn't for the faint of heart. If you really know your Javascript and are comfortable with your landing pages, then you might consider adding custom validation on top of Marketo's built-in validation: Adding custom validation to a Marketo form before submitting it

     

    The function Mkto.validateField processes the form fields and checks their values.  By changing that function, you can replace or remove Marketo's built-in form validation.

     

    Note: Please ensure that you have access to an experienced JavaScript developer. Marketo Technical Support is not set up to assist with troubleshooting JavaScript.

    Disabling Validation

     

    To disable Javascript validation outright, add this javascript to your landing page as a Custom HTML block or on your landing page template:

    <script type="text/javascript">
      Mkto.validateField =  function(fld) { return true; }
    </script>

     

    Custom Validation

     

    If you want to do your own validation, open http://appl.marketo.com/js/mktFormSupport.jsand find the Mkto.validateField function.

     

    It does lots of validation including email addresses, required fields, and phone numbers.  If you want to do your own validating instead of Marketo's, replace the Mkto.validate function by using a dedicated Custom HTML block or by editing your landing page template:

     

    <script type="text/javascript">
    Mkto.validateField =  function(fld) {
        // code goes here.  return true if it's valid, false otherwise
      return true;
    }
    </script>

     

    Instead, you really should keep the Marketo validation and instead add your own custom validation on top of that:

    Adding custom validation to a Marketo form before submitting it