Conditions aren't working for date field when used across pages

Created on 16 June 2025, 22 days ago

Problem/Motivation

When conditions are attached to a date field, they don't work when the controlling field is on another page.

Steps to reproduce

  • Create webform
  • Create two pages.
  • Add the controlling field on the first page
  • Add the date field on the next page
  • Attach conditions to the date field, that are controlled by the controlling field, i.e. visible and required.
  • Test

Proposed resolution

There is code within Drupal\webform\Plugin\WebformElement\DateBase::prepare that attaches Drupal states library and element attributes using the #states prop. This function is run before Drupal\webform\WebformSubmissionConditionsValidator handler class which determines the validity of the states and whether to unset them or not.

Remaining tasks

Move the logic to the #after_build callback of the element.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

6.3

Component

Code

Created by

🇦🇺Australia mortim07

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024