SOLVED

Re: Same Field in Different Fieldsets

Go to solution
Alexis_D_Alba1
Level 5

Same Field in Different Fieldsets

Hi there,

I'm creating a form that will display two different sets of questions based on what the lead selects for the first question on the form.

So, If the lead selects answers A) for question #1, then a set of questions will display. If the leads selected answer B) then a different set of questions will display.

I started using a field set for this combined with visibility rules. There are 3 fields that should display in both fieldsets, however, since I am unable to add the field twice this does not work. Does anyone have any recommendation on the best way to go about this without  using visibility rules for every single question on the form?

Thanks!

Alexis

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Same Field in Different Fieldsets

OK, here you go: MktoForms2 :: Field in 2 Fieldsets

The concept here is simple: you put the field(s) that should "roam" between different fieldsets outside of the fieldset, and then the JS takes care of moving it in and out when a matching fieldset becomes visible.

The actual JS implementation, of course, is rather complex. But the only part you need manage is what's in the short

     /* / user config section \ */

In there, you tell the script what fieldsets it is to manage, and what fields need to roam.

Snapshot of form setup:

pastedImage_0.png

View solution in original post

7 REPLIES 7
Grégoire_Miche2
Level 10

Re: Same Field in Different Fieldsets

Hi Alexis,

This obvisouly can only be managed through JS coding.

You will need to intercept the event of the value choice in question #1 and show fields based on this.

Sanford Whiteman​ if the Guru on this forum fort these types of things.

-Greg

Alexis_D_Alba1
Level 5

Re: Same Field in Different Fieldsets

Thanks, Grégoire Michel

Sanford Whiteman​ i'd really appreciate any tips you have on how I can set this up.

Thanks!

SanfordWhiteman
Level 10 - Community Moderator

Re: Same Field in Different Fieldsets

Yep, I have it, let me clean up the code a little and post it tomorrow. 

it's pretty straighforward to me, but it's gonna be a lot of code to look at (or look away from!) for this task.

SanfordWhiteman
Level 10 - Community Moderator

Re: Same Field in Different Fieldsets

OK, here you go: MktoForms2 :: Field in 2 Fieldsets

The concept here is simple: you put the field(s) that should "roam" between different fieldsets outside of the fieldset, and then the JS takes care of moving it in and out when a matching fieldset becomes visible.

The actual JS implementation, of course, is rather complex. But the only part you need manage is what's in the short

     /* / user config section \ */

In there, you tell the script what fieldsets it is to manage, and what fields need to roam.

Snapshot of form setup:

pastedImage_0.png

Alexis_D_Alba1
Level 5

Re: Same Field in Different Fieldsets

Awesome. thank you very much!

SanfordWhiteman
Level 10 - Community Moderator

Re: Same Field in Different Fieldsets

Sure, if you could Mark Correct when you get a chance.

Alok_Ramsisaria
Level 10

Re: Same Field in Different Fieldsets

Hi Alexis,

Marketo does not support to add the same field multiple times in the same form and that actually makes sense. And your requirement can be fulfilled very easily using the visibility rules and I would also recommend you to go with visibility rules.

Other only way is custom JavaScript, you have to write the custom code that will initiate on "MktoForms2.loadForm" and then you can create the 2 arrays with the field id's that you need to show on answer A or B of the 1st question. Then you can show or hide the fields of Array 1 and 2 on the basis of change of Question 1's answer.

For the marketo form js, you can refer here: http://developers.marketo.com/documentation/websites/forms-2-0/

Thanks,
Alok