{"id":206,"date":"2024-02-04T13:08:44","date_gmt":"2024-02-04T13:08:44","guid":{"rendered":"https:\/\/www.martech-magic.com\/?p=206"},"modified":"2024-02-09T20:07:49","modified_gmt":"2024-02-09T20:07:49","slug":"form-field-visibility-via-url-parameter","status":"publish","type":"post","link":"https:\/\/www.martech-magic.com\/index.php\/2024\/02\/04\/form-field-visibility-via-url-parameter\/","title":{"rendered":"Form Field Visibility via URL Parameter"},"content":{"rendered":"\n<p>So there&#8217;s a thing in Marketo that&#8217;s called &#8220;Form Field Visibility&#8221;. <a href=\"https:\/\/experienceleague.adobe.com\/docs\/marketo\/using\/product-docs\/demand-generation\/forms\/form-fields\/dynamically-toggle-visibility-of-a-form-field.html?lang=en\">Marketo Docs<\/a> say it can &#8220;dynamically toggle the visibility of a form field&#8221;. Fine, let&#8217;s be a bit more specific.<\/p>\n\n\n\n<p>The standard example is &#8220;If Country = United States&#8221; display the field &#8220;State&#8221; with the picklist of all US states. If Country does any other value, don&#8217;t show the field. Or: If &#8220;Country = Canada&#8221; display the field state with the picklist of all Canadian territories. (How to display picklists dynamically is probably not that obvious, but that&#8217;s another story.).<\/p>\n\n\n\n<p>Alright, so we display fields dependent on other field&#8217;s values. How does a field get a value? There are a few options here:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The value is entered into the form or selected from a picklist by the page visitor<\/li>\n\n\n\n<li>The value gets pre-filled through Marketo&#8217;s Form Pre-Fill mechanism<\/li>\n\n\n\n<li>The value gets added to the form from a link&#8217;s URL parameter<\/li>\n<\/ol>\n\n\n\n<p>All of these work nicely for Form Field Visibility. Let&#8217;s see how it actually works with a URL parameter:<\/p>\n\n\n\n<p>Create a form and add a field as a hidden field. I chose the field &#8220;Parameter&#8221; here which I created in my Marketo Sandbox. You can use any field that you already have in your instance &#8211; if you have something like &#8220;UTM_Medium&#8221; or so already, use that.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"417\" src=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image.png\" alt=\"\" class=\"wp-image-207\" srcset=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image.png 320w, https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-230x300.png 230w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><\/figure>\n<\/div>\n\n\n<p>Now click on the &#8220;Autofill&#8221; options in the right navigation and select &#8220;Get Value from: URL Parameter&#8221; and select &#8220;parameter&#8221; as your Parameter Name. You can freely choose your parameter name here &#8211; it doesn&#8217;t have to be the name of the field.<\/p>\n\n\n\n<p> <\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"503\" height=\"403\" src=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-1.png\" alt=\"\" class=\"wp-image-208\" srcset=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-1.png 503w, https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-1-300x240.png 300w\" sizes=\"auto, (max-width: 503px) 100vw, 503px\" \/><\/figure>\n<\/div>\n\n\n<p>Now you have defined that if you hit the landing page where this form lives with something like &#8220;?parameter=show&#8221;, the value &#8220;show&#8221; is being written to the field &#8220;Parameter&#8221;. (If you want to go to the basics of what a URL Parameter or a Query String is, visit <a href=\"https:\/\/en.wikipedia.org\/wiki\/Query_string\">Wikipedia<\/a>).<\/p>\n\n\n\n<p>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 &#8211; let&#8217;s say: City &#8211; and add Visibility Rules from the right navigation:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"551\" src=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-2-1024x551.png\" alt=\"\" class=\"wp-image-209\" srcset=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-2-1024x551.png 1024w, https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-2-300x161.png 300w, https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-2-768x413.png 768w, https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-2.png 1274w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n<\/div>\n\n\n<p>And now define that you want to show the field &#8220;City&#8221; if the value in &#8220;Parameter&#8221; is &#8220;show&#8221;.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"567\" height=\"495\" src=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-3.png\" alt=\"\" class=\"wp-image-210\" srcset=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-3.png 567w, https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-3-300x262.png 300w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><\/figure>\n<\/div>\n\n\n<p>If you save this, you&#8217;ll see that &#8220;City&#8221; greys out to indicate it is hidden by default.<\/p>\n\n\n\n<p>Save and approve your form and add it to a Marketo Landing Page. Now visit your LP and it will look like this:<\/p>\n\n\n\n<p>https:\/\/marketo.example.com\/mylandingpage<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"481\" src=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-4.png\" alt=\"\" class=\"wp-image-211\" srcset=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-4.png 731w, https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-4-300x197.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/figure>\n\n\n\n<p> Now add the URL parameter and refresh the page:<\/p>\n\n\n\n<p>https:\/\/marketo.example.com\/mylandingpage?parameter=show<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"589\" src=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-5.png\" alt=\"\" class=\"wp-image-212\" srcset=\"https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-5.png 729w, https:\/\/www.martech-magic.com\/wp-content\/uploads\/2024\/02\/image-5-300x242.png 300w\" sizes=\"auto, (max-width: 729px) 100vw, 729px\" \/><\/figure>\n\n\n\n<p>Dynamic Form Field Visibility is cool, isn&#8217;t it?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Can you control Form Field Visibility on Marketo forms through URL parameters?<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,8],"tags":[],"class_list":["post-206","post","type-post","status-publish","format-standard","hentry","category-forms","category-tipps-tricks","entry"],"_links":{"self":[{"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/posts\/206","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/comments?post=206"}],"version-history":[{"count":3,"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/posts\/206\/revisions"}],"predecessor-version":[{"id":227,"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/posts\/206\/revisions\/227"}],"wp:attachment":[{"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/media?parent=206"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/categories?post=206"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.martech-magic.com\/index.php\/wp-json\/wp\/v2\/tags?post=206"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}