Show form fields based on segments | Community
Skip to main content
Level 2
January 2, 2025
Solved

Show form fields based on segments

  • January 2, 2025
  • 1 reply
  • 1388 views

Hi, 

I have a requirement for a Marketo form where the form fields should be visible based on segments.

There are three segments (eg. seg1, seg2 and seg 3) and three form fields. Field1 should be visible to a set of people belonging to seg1 and so on. Can we implement this?

 

 

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

It’s very possible and quite simple!

 

Create a Form Visibility Manager field. I typically have 3 or 4 such fields in every instance. They’re just standard String fields:

 

This is the field you’ll add to the form as a Hidden field to control visibility.

 

Then create a mktoText area on the page (put it just before the closing <body> tag) and make that mktoText dynamic using your desired Segmentation.

 

Each variant has a tiny bit of JS to sets the Hidden field to the corresponding segment, i.e. this is for the segment “US”:

 

<script> MktoForms2.whenReady(function(readyForm){ readyForm.setValues({ formVisibilityManagerA: "US" }); }); </script>

 

 

And this is for the segment “MX”:

 

<script> MktoForms2.whenReady(function(readyForm){ readyForm.setValues({ formVisibilityManagerA: "MX" }); }); </script>

 

 

Just treat Form Visibility Manager A as if it were the segmentation.

1 reply

uditmathur
Community Advisor
Community Advisor
January 2, 2025

Hi @harshadoak ,

With Marketo Visibility Rule you can definitely design your form to show specific fields based on specific conditions.

The only condition here will be the customer will have to select their segment 1st & based on their selection corresponding fields can be displayed.

In your given scenario if the customer select Seg1 then a new field titled Job Title will be displayed.

Similarly if customer selects Seg2 a new field of country will be displayed 

 

Hope this Helps 😊

Level 2
January 2, 2025

Thanks for you response however my requirement is slightly different. We have  created segments to categorise the target audience. Based on the segments, form fields should be visible to only those set of people. 

Unfortunately, we can not pull segments in Marketo forms, we can only add fields.

SanfordWhiteman
SanfordWhitemanAccepted solution
Level 10
January 2, 2025

It’s very possible and quite simple!

 

Create a Form Visibility Manager field. I typically have 3 or 4 such fields in every instance. They’re just standard String fields:

 

This is the field you’ll add to the form as a Hidden field to control visibility.

 

Then create a mktoText area on the page (put it just before the closing <body> tag) and make that mktoText dynamic using your desired Segmentation.

 

Each variant has a tiny bit of JS to sets the Hidden field to the corresponding segment, i.e. this is for the segment “US”:

 

<script> MktoForms2.whenReady(function(readyForm){ readyForm.setValues({ formVisibilityManagerA: "US" }); }); </script>

 

 

And this is for the segment “MX”:

 

<script> MktoForms2.whenReady(function(readyForm){ readyForm.setValues({ formVisibilityManagerA: "MX" }); }); </script>

 

 

Just treat Form Visibility Manager A as if it were the segmentation.