LP1904036 org-select rejects invalid free text
authorBill Erickson <berickxx@gmail.com>
Wed, 10 Nov 2021 15:18:58 +0000 (10:18 -0500)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:13:39 +0000 (20:13 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Open-ILS/src/eg2/src/app/share/org-select/org-select.component.html
Open-ILS/src/eg2/src/app/share/org-select/org-select.component.ts

index 89d7bb5..5a38457 100644 (file)
@@ -21,6 +21,7 @@
     [ngbTypeahead]="filter"
     [resultTemplate]="displayTemplate"
     [inputFormatter]="formatter"
+    (blur)="handleBlur()"
     (click)="click$.next($event.target.value)"
     (selectItem)="orgChanged($event)"
     container="body"
index 6a8bd9e..d0a1b79 100644 (file)
@@ -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<string>): Observable<OrgDisplay[]> => {
 
         return text$.pipe(