From 71b1447c5c8edaa252005f7417960c6262196ff7 Mon Sep 17 00:00:00 2001 From: Jerry Padgett Date: Tue, 18 May 2021 11:20:39 -0400 Subject: [PATCH] Quick fix to add lookups. (#4400) - prevent code overwrite on already selected drug. --- templates/prescription/general_edit.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/templates/prescription/general_edit.html b/templates/prescription/general_edit.html index e3890e015..2a2e69a35 100644 --- a/templates/prescription/general_edit.html +++ b/templates/prescription/general_edit.html @@ -173,7 +173,7 @@ {xlt t='Use RxCUI'} - + ({xlt t='Search Web API'}) @@ -435,9 +435,13 @@ function CheckRequired(objID) { return true; } - $(document).on('select2:select', 'select#drug', function(e) { - let optionText = document.getElementById("drug").options[this.selectedIndex].text; + let idx = this.selectedIndex; + if (idx === 0) { + // already selected. + return false; + } + let optionText = document.getElementById("drug").options[idx].text; let rxcode = (optionText.split('(RxCUI:').pop().split(')')[0]).trim(); $("#rxnorm_drugcode").val(rxcode); }); -- 2.11.4.GIT