Forum Discussion

linda2221's avatar
linda2221
Qrew Member
4 days ago

dynamic form rules

I have a form that has 4 sections, that I want to hide or show, based on the selections from two dropdowns.

Conditions:

If dropdown 1 = "Approval" & dropdown 2 = "A" OR "B" then hide sections 2,3

If dropdown 1 = "Approval" & dropdown 2 = "C" then hide sections 2,3 and show section 4

If dropdown 1 <> "Approval" & regardless of the value in dropdown 2, I would like it to hide sections 2, 3, 4

How can I do this? by the time it gets to the third rule, it shows all the sections.

2 Replies

  • Maria's avatar
    Maria
    Community Manager

    Have you tried mapping out the logic in reverse?

    Instead of focusing on the field values, the 1st thing is consider is what needs to show. List all of the possible form configurations, starting with the most "restrictive" to the most "permissive". 

    • Hide sections 2, 3 & 4
    • Hide sections 2 & 3, show 4
    • Hide sections 3 & 4, show 2
    • Hide sections 2 & 4, show 3
    • Hide section 4, show 2 & 3
    • Hide section 2, show 3 & 4
    • Hide section 3, show 2 & 4
    • Show sections 2, 3 & 4

     

    These are probably not all valid options for your form, but I'm just working with the example you gave us. You probably don't need all of these. Anyway, now that all the form configurations are defined, under what circumstances are each of these supposed to happen? 

    • [Field 1] <> "Approved"
    • [Field 1] = "Approved",  [Field 2] <> "C"
    • [Field 1] = "Approved",  [Field 2] = "C"

     

    Pay attention to overlapping logic, such as using [Field 2] <> "C" instead of "equals A or B" for clarity and to be more concise.

    Building with this mindset should help you get to your desired results.