Skip to content

Hide validation errors on dependent fields emptied by a dependency change - #62

Open
Amoifr wants to merge 1 commit into
SymfonyCasts:mainfrom
Amoifr:fix-50-revalidation-on-option-change
Open

Hide validation errors on dependent fields emptied by a dependency change#62
Amoifr wants to merge 1 commit into
SymfonyCasts:mainfrom
Amoifr:fix-50-revalidation-on-option-change

Conversation

@Amoifr

@Amoifr Amoifr commented Aug 18, 2026

Copy link
Copy Markdown

Fix #50

When a dependency changes, the UI re-renders its dependent field emptied. The submitted stale value was already handled for transformation failures: the error is cleared and moved to the hidden __dynamic_error field, so nothing is rendered but the form stays invalid.

Constraint violations were not: returning to a previous option submits the dependent field empty, and a NotBlank violation popped up on a field the user never got to fill (the error shown in the issue's video).

This applies the same treatment to violations: when a dependency's submitted data differs from its initial data and the dependent field was submitted empty, its errors are cleared and the hidden error keeps the form invalid. Errors still render when the dependency did not change: submitting the initial value with an empty dependent field is a real mistake, covered by a test.

Ships functional tests on a new fixture form carrying a NotBlank constraint (symfony/validator added to require-dev), walking the exact A / B / A flow from the issue's video.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Some validations errors are shown when an option is changed

1 participant