unclecheese / silverstripe-display-logic

The Display Logic module allows you to add conditions for displaying or hiding certain form fields based on client-side behavior.
BSD 3-Clause "New" or "Revised" License
74 stars 71 forks source link

Need nested conditionals example #46

Closed hailwood closed 1 year ago

hailwood commented 8 years ago

Hey Cheese,

Can we please get an example of how we would display a field if either of two sets of conditionals are true?

E.g.

Fields A, B, C, D

Field D should show if A = 1 AND B = 2 -or- A = 2 AND C = 2

I thought this should work (and PHP doesn't complain), but the JS only outputs the first part of the conditional (if A = 1 AND B = 2).

->displayIf('ApplicationType')->isEqualTo('Individual')
->andIf("NZResidentIndividual")->isEqualTo("No")
  ->group()->orIf()
    ->group()
      ->andIf("ApplicationType")->isEqualTo("Joint")
      ->andIf("NZResidentJoint")->isEqualTo("No")
->end()
michalkleiner commented 1 year ago

I think the kitchen sink example covers this now.