Drupal 10 Upgrade Issue: Required Field Error with Dependent Visibility

Created on 14 August 2023, 11 months ago
Updated 11 September 2023, 10 months ago

Problem/Motivation

I have encountered an issue with conditional_fields after upgrading from Drupal 9 to Drupal 10. The problem concerns a content type which has a required field that is only visible when another control field (a checkbox in this case) is checked. Prior to the update, checking the checkbox would reveal the required field for filling out, while leaving it unchecked would keep the field hidden and allow the node to be saved without any issues. However, after the update, even if the checkbox remains unchecked, the hidden field still produces an error when attempting to save the content.

Steps to reproduce

  1. Create a content type with a control field and a dependent required field.
  2. In Drupal 9, ensure that the required field's visibility is dependent on the value of the control field.
  3. Upgrade the website to Drupal 10.
  4. Create a node of the content type and leave the control field unchecked.
  5. Attempt to save the node and observe the erroneous required field error.

Proposed resolution

The issue seems to be related to the handling of field dependencies and required status during the Drupal 9 to Drupal 10 upgrade. A proposed resolution is to review the changes in Drupal 10 that might affect the visibility and required status of dependent fields. This could involve investigating changes in the field API and/or form rendering logic. Once identified, a patch or workaround can be developed to ensure that the required field behaves as expected based on the control field's value.

Remaining tasks

  • Investigate Drupal 10 field API changes and form rendering logic that might impact field dependencies. 🤷‍♂️
  • Develop and test a solution to ensure that the required field error is triggered only when the control field is checked.

User interface changes

N/A. The focus is on addressing the backend logic to ensure proper visibility and required status handling for dependent fields.

API changes

Depending on the findings during the investigation, there might be necessary changes or enhancements to support the correct handling of field dependencies and required status in Drupal 10.

Data model changes

No changes to the data model are expected as part of this issue.

🐛 Bug report
Status

Active

Version

4.0

Component

Code

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

Comments & Activities

Production build 0.69.0 2024