Form Field Visibility via URL Parameter

So there’s a thing in Marketo that’s called “Form Field Visibility”. Marketo Docs say it can “dynamically toggle the visibility of a form field”. Fine, let’s be a bit more specific.

The standard example is “If Country = United States” display the field “State” with the picklist of all US states. If Country does any other value, don’t show the field. Or: If “Country = Canada” display the field state with the picklist of all Canadian territories. (How to display picklists dynamically is probably not that obvious, but that’s another story.).

Alright, so we display fields dependent on other field’s values. How does a field get a value? There are a few options here:

  1. The value is entered into the form or selected from a picklist by the page visitor
  2. The value gets pre-filled through Marketo’s Form Pre-Fill mechanism
  3. The value gets added to the form from a link’s URL parameter

All of these work nicely for Form Field Visibility. Let’s see how it actually works with a URL parameter:

Create a form and add a field as a hidden field. I chose the field “Parameter” here which I created in my Marketo Sandbox. You can use any field that you already have in your instance – if you have something like “UTM_Medium” or so already, use that.

Now click on the “Autofill” options in the right navigation and select “Get Value from: URL Parameter” and select “parameter” as your Parameter Name. You can freely choose your parameter name here – it doesn’t have to be the name of the field.

Now you have defined that if you hit the landing page where this form lives with something like “?parameter=show”, the value “show” is being written to the field “Parameter”. (If you want to go to the basics of what a URL Parameter or a Query String is, visit Wikipedia).

Okay, now that we can write a value to a field through a URL parameter we can use it for Form Field Visibility. Create another field on your form – let’s say: City – and add Visibility Rules from the right navigation:

And now define that you want to show the field “City” if the value in “Parameter” is “show”.

If you save this, you’ll see that “City” greys out to indicate it is hidden by default.

Save and approve your form and add it to a Marketo Landing Page. Now visit your LP and it will look like this:

Now add the URL parameter and refresh the page:

Dynamic Form Field Visibility is cool, isn’t it?