Overriding or Disabling Marketo Form Validation | Community
Skip to main content
December 30, 2014

Overriding or Disabling Marketo Form Validation

  • December 30, 2014
  • 2 replies
  • 5904 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Level 4
November 12, 2015

Hey @Cory Burnsed and @Raul Fonseca, do you have an updated link for the last resource you listed? Your original link for "Adding custom validation to a Marketo form before submitting" just links to the new product doc page.

Thanks,
Liliana

November 24, 2015

Hi Liliana -- not sure if you still need this, but here's the link:

Adding custom validation to a Marketo form before submitting it