Form - conditional field

i am trying to set up a form, that when a checkbox is ticked, it displays another field.

I think this is what the conditional field is for.
i have tried it in a form.md page with a checkbox and its id set

condition: “id ? ‘false’ : ‘true’”

it only displays when i set the default, it doesnt live update when toggled

further to this it completely breaks a modular page.

am i using this correctly?

    - type: conditional
      condition: 'true'
      classes: overlay bottom

      fields:
          field-a:
              label: New Field A
              type: text

          field-b:
              label: New Field B
              type: text

Hi,

The conditional field will only evaluate the condition when the page is generated, not dynamically.
Condition has to be a ternary twig condition.
You therefore have to use javascript to achieve what you want.

Hope it helps!

1 Like