SOLVED

Field Values Based on Previous Selections

Go to solution
Chris_Perez2
Level 3

Field Values Based on Previous Selections

I'm working in Forms 2.0 and know how to hide/show fields. What I would like to do is show/hide field values based on multiple selections: 
FIELD NAME - Product name: FIELD VALUES- Product A, Product B, Product C, Product D....
FIELD NAME - Support Representative: FIELD VALUES - Rep A, Rep B, Rep C

If Product A is chosen, only Rep A displays in the picklist
If Product B is chosen, only Rep B displays in the picklist
If Product C
 is chosen, only Rep C displays in the picklist
If Product A AND B
 are chosen, only Reps A AND B display in the picklist
If Product A AND C
 are chosen, only Reps A AND C display in the picklist
If Product B AND C
 are chosen, only Reps B AND C display in the picklist
If Product D is chosen, Reps A, B and C display in the picklist
 
My values go well past three values and I am trying to avoid creating numerous new fields to hide/show and would prefer to use a single field if possible. 

 



 

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Field Values Based on Previous Selections

@Chris, like @Josh says this is something to build in JS using the Forms 2.0 API... something like this demo I just put together. (Maybe to add to the Forms 2.0 Cookbook I'm working on to compile similar crazy stuff I've done lately.)

This example uses dependency rules stored as JSON -- the rules are actually embedded in the form as a supplementary rich text component so you can manage them within the Form Editor (not that the editor has any idea what they mean, but it keeps everything centralize). Rules look like this:
{
  "Product A": {
    "Rep A": true
  },
  "Product B": {
    "Rep B": true
  },
  "Product C": {
    "Rep C": true
  },
  "Product D": {
    "Rep A": true,
    "Rep B": true,
    "Rep C": true
  }
}

View solution in original post

4 REPLIES 4
Josh_Hill13
Level 10 - Champion Alumni

Re: Field Values Based on Previous Selections

I think Visibility Rules will not let you do this. They work best with few variables and choices.

I would recommend using a custom javascript to control this. It will work better.
SanfordWhiteman
Level 10 - Community Moderator

Re: Field Values Based on Previous Selections

@Chris, like @Josh says this is something to build in JS using the Forms 2.0 API... something like this demo I just put together. (Maybe to add to the Forms 2.0 Cookbook I'm working on to compile similar crazy stuff I've done lately.)

This example uses dependency rules stored as JSON -- the rules are actually embedded in the form as a supplementary rich text component so you can manage them within the Form Editor (not that the editor has any idea what they mean, but it keeps everything centralize). Rules look like this:
{
  "Product A": {
    "Rep A": true
  },
  "Product B": {
    "Rep B": true
  },
  "Product C": {
    "Rep C": true
  },
  "Product D": {
    "Rep A": true,
    "Rep B": true,
    "Rep C": true
  }
}
Chris_Perez2
Level 3

Re: Field Values Based on Previous Selections

Sanford - your example is exactly what I am looking for, although I'm not clear regarding the placement of the script. I'm not a developer, but can read/write code based on examples like the one you provided and know that once I understand the placement I can make the code you shared work for me . Thanks for your help!
 
Regards,

Chris

SanfordWhiteman
Level 10 - Community Moderator

Re: Field Values Based on Previous Selections

@Chris Feel free to contact me if you want to chat more about it.