Problem/Motivation
Field Group Complete currently evaluates field group completeness and error state primarily by inspecting form controls such as input, select, and textarea. This works for many simple fields and for validation errors attached directly to child controls.
However, some Drupal form widgets are composite widgets. Validation errors for those widgets may be attached to the wrapper, fieldset, or other composite container rather than only to an individual child control.
Examples include composite fields such as Name and Address, as well as other widgets that render multiple child controls under one field wrapper.
When a validation error is attached at the composite wrapper level, Field Group Complete may fail to preserve the field group error state correctly. In some cases, stale-error handling can clear the tab error state too aggressively after a child control is marked dirty, even though required child controls inside the errored wrapper are still incomplete.
Steps to reproduce
Create a content type with a composite field or widget that renders multiple child controls inside a fieldset or wrapper.
Place that field inside a Field Group tab.
Trigger backend validation so the composite wrapper receives an error state, for example fieldset.error or aria-invalid="true".
Edit one child control inside the composite widget, while leaving other required child controls empty.
Observe that Field Group Complete may clear or fail to preserve the tab error state even though the composite widget is still incomplete.
Proposed resolution
Update Field Group Complete so validation errors attached to composite wrappers are treated as active field group errors.
When an errored composite wrapper has dirty child controls, Field Group Complete should only ignore the stale wrapper error if the required child controls inside that wrapper are now complete.
This keeps stale backend errors from permanently blocking a tab from becoming complete, while still preserving the error state for composite widgets that remain incomplete.
Remaining tasks
Add test coverage for validation errors attached to composite wrappers.
The test should verify that:
- A field group containing an errored composite wrapper receives the expected error/incomplete state.
- Editing one child control does not clear the group error state while other required controls in the same composite wrapper remain incomplete.
- Once the required child controls are complete, stale backend wrapper errors no longer prevent the group from becoming complete.
User interface changes
Field group tabs containing composite wrapper validation errors will more accurately show their incomplete/error state.
API changes
None expected.
Issue fork field_group_complete-3588094
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 commentedComment #3
jcandan commentedComment #5
jcandan commentedThis specifically solves issues we had with the Address module.