Problem
Field Group Complete can leave a field group tab marked incomplete when a conditional gate changes after validation errors have already been shown.
This can happen when a boolean single-checkbox field controls whether other fields inside the same field group are shown, hidden, required, or required-on-publish.

Steps to reproduce
- Create a field group tab.
- Add a boolean field using the single-checkbox widget.
- Add another field inside the same field group.
- Configure the second field so that its visibility required state depends on the boolean checkbox.
- Submit the form in a state that causes the dependent field to show a validation error.
- Tick the checkbox so that the dependent field is hidden or no longer required.
Expected behavior
The field group completeness badge should update when the checkbox changes.
If the dependent field is hidden or no longer required, it should not continue to keep the field group marked incomplete or errored.
Actual behavior
The field group tab remains incomplete, even after the checkbox changes the state of the dependent field.
Notes
This appears to be related to stale validation state after a conditional field changes. The current field-specific update behavior is not sufficient when the change that affects completeness comes from a another field rather than from the errored field itself.
| Comment | File | Size | Author |
|---|
Issue fork field_group_complete-3590213
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
jcandan commentedI think there are two related but separable concerns here.
First, Field Group Complete (FGC) needs to recompute when a gate field changes, not only when the currently errored field itself changes (or blurs). In this case, the boolean checkbox is what changes whether the dependent field should count toward completeness, so field-specific handling on the errored dependent field is not enough.
Second, I do not think FGC necessarily needs to fully interpret the Form States API
#statesexpression in order to decide completeness. It may be reasonable to inspectdata-drupal-statesto discover that one field depends on another and therefore know when to trigger a recompute. But the actual completeness calculation may need to stay generic: look at the current rendered state of the form and decide whether the relevant required, required-on-publish, or errored controls are currently visible/applicable inside the field group.That avoids making FGC responsible for reimplementing all of Drupal states logic or custom states semantics. For example,
require_on_publishis not a core state with a universal meaning; it is meaningful because another module adds behavior around it. Similarly, Conditional Fields may use states-style expressions, but the important result for FGC is whether the field is currently visible/applicable and should count.So my current leaning is:
That seems like a reasonable middle ground: FGC can react to conditional dependencies without becoming a second implementation of Drupal states or of module-specific states such as required-on-publish.
Comment #4
jcandan commented