3

I have a webform that has a custom composite element; let's name it composite_name.

Within that custom composite, I have element_a, element_b, and element_c.

Is it possible to make element_c visible only when a value is entered in either element_a or element_b, by editing the composite element in the Webform UI?

I tried putting this in the custom properties for element_c, but it does not work:

states:
  visible:
    - ':input[name=["composite_name"]["element_a"]]':
        filled: true
    - or
    - ':input[name=["composite_name"]["element_b"]]':
        filled: true

I also tried a few variations on that, with no success. I don't know whether I just have some punctuation out of place or something.

It looks like I could make the condition happen using a custom module (following the webform_example_composite module's code), but I'm hoping to configure it in the UI.

1 Answer 1

0

Conditions need to be set per row.

The webform_example_composite.module, included w/ Webform, shows how to do this via \Drupal\webform_example_composite\Element\WebformExampleComposite

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.