Time-only fields fail conditional required validation when set to 00:00, but without an actual validation error

Created on 18 June 2024, 9 days ago

Problem/Motivation

When using a time field provided by the time field module β†’ that is conditionally required based on another field value, the conditional fields module will say that such a field has an error when you submit the form if the time value is set to 00:00 (midnight). However, it does not display a validation error stating that the field is required, only that there is an error.

Steps to reproduce

  1. Install the time field module in your site
  2. Add a time field to one of your content types, setting it as not required
  3. Create condition that makes it required based on the value of some other field
  4. Create or edit a node of that type, trigger the condition to make your time field required and enter a value of 00:00
  5. Try to save the node and it will fail, though what you see may depend on whether you have enabled the inline form errors module in core or not. With it enabled, it will say at the top of the form that your field has an error, but no error message is displayed inline with the field and it has no error class. Without that enabled, I'm not sure what the result would look like.

Proposed resolution

Not sure exactly what's required to address this, but it's likely a matter of fixing something in the code that handles the conditional validation. I haven't had the time yet to review and understand it in detail.

Remaining tasks

  • Review code and perform some troubleshooting and testing to determine the root cause
  • Identify the issue - is it a problem with this module, or something to do with the Time field module?
  • Produce a patch for this module, if applicable, or submit an issue about it on the Time field module
πŸ› Bug report
Status

Active

Version

4.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada teknocat

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

Comments & Activities

Production build 0.69.0 2024