From c5a6dd27e3e1f293df6331ea2ba8981bd973cc2f Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 10 Nov 2021 10:18:58 -0500 Subject: [PATCH] LP1904036 org-select rejects invalid free text Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/eg2/src/app/share/org-select/org-select.component.html | 1 + Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.html b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.html index 89d7bb51b4..5a38457fea 100644 --- a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.html +++ b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.html @@ -21,6 +21,7 @@ [ngbTypeahead]="filter" [resultTemplate]="displayTemplate" [inputFormatter]="formatter" + (blur)="handleBlur()" (click)="click$.next($event.target.value)" (selectItem)="orgChanged($event)" container="body" diff --git a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts index 6a8bd9eea0..d0a1b7946c 100644 --- a/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts +++ b/Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts @@ -338,6 +338,13 @@ export class OrgSelectComponent implements OnInit { }); } + // Free-text values are not allowed. + handleBlur() { + if (typeof this.selected === 'string') { + this.selected = null; + } + } + filter = (text$: Observable): Observable => { return text$.pipe( -- 2.11.0