Logical operator

Created on 5 April 2025, 17 days ago

Problem/Motivation

By default, with multiple condition on a field, it's the logical "AND" which is applied. But on my D7 Webform I have logical "or", which is not supported yet.

Steps to reproduce

Have a field with multiple conditions but, only one of these conditions could be TRUE to display the field (OR). It's just an example.

Proposed resolution

TBD try to reproduce Logical operator Needs work but with new YAML builder

Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

🇨🇦Canada joelpittet Vancouver

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joelpittet
  • 🇨🇦Canada joelpittet Vancouver
  • @joelpittet opened merge request.
  • 🇨🇦Canada joelpittet Vancouver

    Fix seems to work.

    Here's an example config export diff after it works, that is the way the current webform exports this.

    diff --git a/config/sync/webform.webform.webform_838.yml b/config/sync/webform.webform.webform_838.yml
    index 8474014b2..608564abe 100644
    --- a/config/sync/webform.webform.webform_838.yml
    +++ b/config/sync/webform.webform.webform_838.yml
    @@ -149,16 +149,17 @@ elements: |-
                 checked: true
       current_employer:
         '#type': textfield
    -    '#unique': false
    -    '#title_display': inline
         '#title': 'Current employer'
    +    '#title_display': inline
         '#states':
           visible:
    -        - ':input[name="current_employment_status[industry]"]':
    +        - ':input[name="current_employment_status[Industry]"]':
                 checked: true
    -        - ':input[name="current_employment_status[academia]"]':
    +        - or
    +        - ':input[name="current_employment_status[Academia]"]':
                 checked: true
    -        - ':input[name="current_employment_status[startup]"]':
    +        - or
    +        - ':input[name="current_employment_status[Startup]"]':
                 checked: true
       current_job_title:
         '#type': textfield

    Note the keys aren't lowercased because that is not correct and has been corrected here as well.

Production build 0.71.5 2024