Skip to content

fix(field): keep server validation message on the form control - #648

Merged
tumms2021389 merged 1 commit into
release/25.1from
fix/dec/BUG-1032755
Oct 30, 2026
Merged

tumms2021389 merged 1 commit into
release/25.1from
fix/dec/BUG-1032755

Conversation

@tumms2021389

@tumms2021389 tumms2021389 commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

displayValidationMessage() used setErrors() to put the server-side validatemessage on the FormControl. setErrors() is a one-off override, so any later updateValueAndValidity() call wiped it out. That happens when the base or subclass setValue() runs after
updateComponentCommonProperties(), and when the [formControl] or [required] directives set up or change. It used to work only because setErrors() was wrapped in setTimeout(100).

Add a validator to fieldControl that returns { message: true } while angularPConnectData.validateMessage is set, then re-run validation. The error is now re-applied every time validation runs and clears on its own when the message goes away. shows reliably without the timeout.

The validator is attached in displayValidationMessage() because some subclasses create their own fieldControl.

(EA-D17238)

displayValidationMessage() used setErrors() to put the server-side
validatemessage on the FormControl. setErrors() is a one-off override,
so any later updateValueAndValidity() call wiped it out. That happens
when the base or subclass setValue() runs after
updateComponentCommonProperties(), and when the [formControl] or
[required] directives set up or change. It used to work only because
setErrors() was wrapped in setTimeout(100).

Add a validator to fieldControl that returns { message: true } while
angularPConnectData.validateMessage is set, then re-run validation.
The error is now re-applied every time validation runs and clears on
its own when the message goes away. <mat-error> shows reliably without
the timeout.

The validator is attached in displayValidationMessage() because some
subclasses create their own fieldControl.
@tumms2021389 tumms2021389 self-assigned this Oct 29, 2026
@tumms2021389
tumms2021389 merged commit eb37bca into release/25.1 Oct 30, 2026
5 checks passed
@tumms2021389
tumms2021389 deleted the fix/dec/BUG-1032755 branch October 30, 2026 07:24
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.

2 participants