[ACS-9374] Show validation error on checking and unchecking checkbox

This commit is contained in:
Shivangi917
2025-07-28 08:08:50 -04:00
parent a0aa13a020
commit 8aedb8f022
2 changed files with 4 additions and 2 deletions
@@ -118,7 +118,7 @@ export class SearchInputControlComponent implements OnInit, OnChanges {
} }
ngOnChanges(changes: SimpleChanges): void { ngOnChanges(changes: SimpleChanges): void {
if (changes['hasLibrariesConstraint'] && !changes['hasLibrariesConstraint'].firstChange && this.searchFieldFormControl.touched) { if (changes['hasLibrariesConstraint'] && !changes['hasLibrariesConstraint'].firstChange) {
this.emitValidationError(); this.emitValidationError();
} }
} }
@@ -149,7 +149,7 @@ export class SearchInputControlComponent implements OnInit, OnChanges {
return this.searchTerm.trim()?.length < 2; return this.searchTerm.trim()?.length < 2;
} }
private emitValidationError(): void { emitValidationError(): void {
const errors = this.searchFieldFormControl.errors; const errors = this.searchFieldFormControl.errors;
if (errors?.whitespace) { if (errors?.whitespace) {
this.validationError.emit('SEARCH.INPUT.WHITESPACE'); this.validationError.emit('SEARCH.INPUT.WHITESPACE');
@@ -211,6 +211,8 @@ export class SearchInputComponent implements OnInit, OnDestroy {
this.syncInputValues(); this.syncInputValues();
this.has400LibraryError = false; this.has400LibraryError = false;
this.searchInputControl.emitValidationError();
if (!this.searchedWord.trim()) { if (!this.searchedWord.trim()) {
return; return;
} }