10 Most Frequently Asked Questions About Marketo Forms (FAQ)
Scroll top

10 Most Frequently Asked Questions About Marketo Forms (FAQ)

Marketo has been huge for marketing automation. We can hardly imagine what it would be like to go back to doing automated marketing without it.

One of Marketo’s greatest strengths is its web forms. Marketo’s Form Editor and Forms APIs have tremendous flexibility and potential. Both contribute heavily to Marketo’s reputation as one of the top marketing automation solutions. View our comparison between Marketo and Hubspot for marketing automation.

However, with great power comes great complexity. In order to wield the full potential of Marketo forms, it is necessary to understand how best to utilize them. It’s especially important to have a sense of what you can accomplish with Marketo’s included features, and what might need to be customized by your dev team.

Find out more about marketing automation in Marketo by watching one of our webinars. Sign-up today!

Also, if you’re thinking about using Marketo or looking to upgrade your Marketo skills to take an existing implementation to the next level, This article is for you. 

Let’s go over common questions that frequently come up when marketers are building campaigns with Marketo. We hope this FAQ will steer you toward true Marketo mastery.

Frequently Asked Questions about Marketo Forms

Q: How do I hide a Marketo form after submission?

A: As much as you want your lead to fill out that form, you also want that form to go away as soon as they’ve submitted it. When a previously-submitted form hangs around like the worst guest at a house party, your lead starts wondering if they actually submitted the form correctly or if you’re just bad at web coding.

You need to use an onSuccess handle like this one. You can find more detailed examples of the code we’re showing you in context on Marketo’s site for this and the next two questions:


form.onSuccess(function(values, followUpUrl) {
        form.getFormElem().hide();
        return false;
    });

Once the user clicks “submit,” they’ll never see the form again – unless you choose to make it reappear for some reason.

Q: How do I prevent a user from submitting a Marketo form?

A: Timing is everything, and sometimes you just don’t want a lead to be firing off a form before its time. If you want to make it impossible for a user to submit a form, this will do the trick:


if (form.submittable()) {
form.submittable(false);}
});

Defining the conditions that “unlock” the form is another question entirely. In its example, Marketo includes code that makes the form submittable again only after a button has been clicked three times. 

Q: How do I set values in a hidden Marketo field form?

A: Everybody in the industry knows that customers get squeamish about watching the marketing sausage get made. Sometimes, you want a submitted form to carry a little payload of information that your lead can’t see. 

Assuming you’ve configured some hidden fields in the form editor when you created your form, this code lets you load those fields with preset values:

form.vals({"hiddenField1":"true", "hiddenDate":"2019-01-01"});

In a later question, you’ll see how you can use hidden fields to discreetly hold automatically-generated data for use when running analytics on your form submissions.

Q: What are MktoForms2 methods?

A: MktoForms2 is an object used in Marketo’s Forms 2.0 API. It’s one of the two main Forms objects you’ll spend most of your time interacting with. It contains functions for creating, loading, and fetching Forms objects.

Here’s a quick rundown of MktoForms2 methods:

  • .loadForm()
    Loads a form descriptor and creates a new Form object.
  • .lightbox()
    Renders a lightbox-style dialog box with the Form object in it.
  • .newForm()
    Creates a new Form object from a Form Descriptor JavaScript object.
  • .getForm()
    Retrieves a previously-created Form object.
  • .allForms()
    Fetches an array of all Form objects previously constructed on the page.
  • .getPageFields()
    Retrieves a JavaScript object containing data from the URL and referrer.
  • .whenReady()
    Adds a callback that will be called once per Form after it meets certain “ready” conditions.
  • .onFormRender()
    Adds a callback that will be called whenever a Form on the page is rendered.
  • .whenRendered()
    Same as above, but also calls the callback immediately for all forms that have already been rendered.

Q: How can I see form submissions for a given time period?

A: If you want to sort and organize reports by the time of their submission, that’s easy enough to do. However, this method will only enable you to track forms by submission time going forward, not retroactively.

The following code will add a hidden field to a form that records a timestamp when the form is submitted:

MktoForms2.whenReady(function(form){
  form.onSubmit(function(form){
   form.addHiddenFields({ LastFormFilloutDateTime : new Date().toUTCString() });
  });

You can then use the timestamp value to sort and filter submitted forms in any spreadsheet or database program they’ve been exported into.

Q: How can I capture lead information in Marketo from a non-Marketo form?

A: When you have a third-party form embedded on your web page, you might want a way to pass information received through that form to Marketo. In theory, this isn’t too difficult to do with a plain HTML form.

Your code needs to catch the HTML “submit” event, transfer the field contents to a bidden Marketo form, and call the Marketo form’s “submit” event.

This can get complicated depending on the types of forms you’re using, but the Marketo community has some coding suggestions for this circumstance.

Q: How do I turn off Munchkin code for Marketo forms?

A: “Munchkin” is what Marketo calls its lead tracking code. The Munchkins do great work serving up cookies and following your leads, but sometimes you may prefer that they make themselves scarce for a while. 

For instance, forms for internal use or special events might end up feeding the Munchkins a lot of confusing and unhelpful data.

At a trade show, you might have a tablet set up with a web form to solicit contact information from your visitors. The Munchkins will see all the forms coming through one device and cookie as one single lead (albeit with multiple personalities and email addresses).

This code will clear the Munchkin cookie value upon submission of the form, but does not delete the cookie itself:

MktoForms2.whenReady( function(form){ 
form.addHiddenFields({"_mkt_trk":""});
form.onSubmit( function(form){
form.vals({"_mkt_trk":""});})
})

The Munchkins will effectively “forget” who submitted the form and you’re free to await the next visitor’s submission.

Q: How can I make a success message show in an embedded Marketo form?

A: If you don’t want to boot your lead over to a different web page once they’ve successfully submitted your form, you can show them an in-line confirmation message. You can even handle more complex situations, like checking for duplicate sign-ups and feeding them a link to an account management page.

Here’s some code for a simple success message:

form.onSuccess(function(values, followUpUrl) {
form.getFormElem().html("Your form has been submitted!");
form.getFormElem().css("text-align","center");
form.getFormElem().css("font-family","'Helvetica'");
return false;
});

Once the lead clicks “submit,” a message appears letting them know that it went through.

Q: How can I create a Marketo form with two fields in the same row and one field in another row?

A: Alternating side-by-side and single fields in one column may not sound like a particularly ambitious design, but it can be a little tricky to pull off in Marketo. There are a few different ways to approach the problem.

The most effective method may be to use an advanced framework using custom CSS, allowing you to use advanced field customization and placement features. It’s possible to use fixed sizes and the Form Editor to set up a form this way, but the placement will not be consistent on smaller screens.

Q: How can I gate online content using a Marketo form?

A: Forms can be a great way to create a checkpoint that requires users to provide some information in order to access additional content. Sometimes it’s better to let information be free and allow your visitors to view and read whatever they want on your site. When you have especially attractive or valuable content, gating it with a form is a great way to pick up some leads.

One way to turn a form into a content gate is to use the Known Visitor HTML feature, which can be found in Form Editor settings. This will display custom HTML pages to “known visitors,” a status you can set once they submit the form.

Conclusion

We hope this FAQ clears up any Marketo questions you might have, and helps you use its forms with confidence. Of course, no mere FAQ can comprehensively address all of the issues and scenarios that advanced users will bring to the surface. Remember that if you’re stumped about how to do something in Marketo, they have an abundance of how-to guides, community support forums, and other resources that can help get you back on track.

With a little creativity in their design and placement, web forms can help you extract all kinds of great information from your leads. It’s hard to beat Marketo when it comes to putting the full weight of your MarTech stack behind efforts to utilize that information.

Simplify your social publishing activities

Learn how Oktopost will help your savvy team, plan, prioritize, and grow a solid social media marketing strategy with the most intuitive tools.

Book a Demo