SOLVED

Re: Show form fields based on segments

Go to solution
harshadoak
Level 2

Show form fields based on segments

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?

 

 

Tags (2)
3 ACCEPTED SOLUTIONS

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Show form fields based on segments

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:

SanfordWhiteman_0-1735845370255.png

 

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.

View solution in original post

harshadoak
Level 2

Re: Show form fields based on segments

@SanfordWhiteman Thanks for your response. I will implement the solution.

One more doubt I have-  What if a person is present in more than one segment? (segments are created for three different  type of newsletters. So it is highly possible a person may present in more than one segment).

View solution in original post

SanfordWhiteman
Level 10 - Community Moderator

Re: Show form fields based on segments

It's not possible to be in more than one segment in the same segmentation. A person falls into the first matching segment, that's it.

View solution in original post

5 REPLIES 5
uditmathur
Level 7 - Community Advisor

Re: Show form fields based on segments

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.

uditmathur_0-1735820751243.pnguditmathur_1-1735820774254.png

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

uditmathur_3-1735820872100.png

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

uditmathur_4-1735820917911.png

 

Hope this Helps 😊

harshadoak
Level 2

Re: Show form fields based on segments

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
Level 10 - Community Moderator

Re: Show form fields based on segments

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:

SanfordWhiteman_0-1735845370255.png

 

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.

harshadoak
Level 2

Re: Show form fields based on segments

@SanfordWhiteman Thanks for your response. I will implement the solution.

One more doubt I have-  What if a person is present in more than one segment? (segments are created for three different  type of newsletters. So it is highly possible a person may present in more than one segment).

SanfordWhiteman
Level 10 - Community Moderator

Re: Show form fields based on segments

It's not possible to be in more than one segment in the same segmentation. A person falls into the first matching segment, that's it.