Skip to main content
Jessica_Biblis
Level 3
September 29, 2016
Question

Edit Form HTML and Add Custom Javascript without Using the API

  • September 29, 2016
  • 2 replies
  • 9036 views

Hi Marketo Community,

We are developing a new email preference center and we want style the form so it is consistent with our brand standard. We also want to have it behave a little differently than the typical out-of-the-box form. The form will be used on a Marketo landing page.

Specifically, we want to be able to style the checkboxes a certain way. And we also want to clear all checkboxes and change the Unsubscribed datavalue to true if someone clicks an "Unsubscribe from all" link.

So far, we haven't been able to find a way to edit the form HTML and add custom Javascript without using the API. We are already using a ton of API calls from our website to Marketo and are concerned about our limits.

Does anyone know if it is possible to accomplish this? Any help would be very much appreciated.

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

2 replies

Grégoire_Miche2
Level 10
September 29, 2016

Hi Jessica,

You could start by editing the CSS of a form theme: Edit the CSS of a Form Theme - Marketo Docs - Product Docs

But if you really want to use some JS, you will have to use the forms 2.0 API, which IS client side JS. This is pretty well documented in here: http://developers.marketo.com/javascript-api/forms/

The forms 2.0 API will enable you to do whatever you want on the form, change it's behaviour, etc...

Also, search the community for @Sanford Whiteman​'s code that enables you to remove Marketo styles from the form and add some handlers so that you can style the form with some CSS on the LP.

-Greg

Jessica_Biblis
Level 3
October 3, 2016

Thank you very much!

September 29, 2016

The Forms 2.0 JS API does not count against your API calls, so that should not be a concern.

We are rolling this out for a client right now where we pull the values from the Marketo prepopulated form into our markup, and then when the user submits the changes to our form, we prevent the submit, push the values into the hidden Marketo form, and then submit it using the Forms 2.0 API.

Jessica_Biblis
Level 3
October 3, 2016

Thanks, Jason. That is super helpful to know.