From c10dbf3955e68db32728fdd48d5216ff36c65366 Mon Sep 17 00:00:00 2001 From: realkaranvir <113927390+realkaranvir@users.noreply.github.com> Date: Tue, 10 Dec 2024 20:09:58 -0800 Subject: [PATCH 1/2] fixed triage validation --- app/femr/ui/views/triage/index.scala.html | 10 +++++----- public/js/triage/triage.js | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/femr/ui/views/triage/index.scala.html b/app/femr/ui/views/triage/index.scala.html index a9329cb72..936be6426 100644 --- a/app/femr/ui/views/triage/index.scala.html +++ b/app/femr/ui/views/triage/index.scala.html @@ -383,8 +383,8 @@

Vitals

- - + +
@@ -427,8 +427,8 @@

Vitals

@if(viewModel.getSettings.isMetric) { - - + + } else { @@ -447,7 +447,7 @@

Vitals

- +
diff --git a/public/js/triage/triage.js b/public/js/triage/triage.js index d0bf05987..9ac8ce185 100644 --- a/public/js/triage/triage.js +++ b/public/js/triage/triage.js @@ -663,7 +663,8 @@ $(document).ready(function () { patientPhotoFeature.flagForDeletion(); }); - $('#triageSubmitBtn').click(function () { + $('#triageSubmitBtn').click(function (e) { + e.preventDefault(); var pass = validate(); var patientInfo = triageFields.patientInformation; var query = patientInfo.firstName.val() + " " + patientInfo.lastName.val(); From 7900611f3216c715e15746d8b45f3c8450a8ac26 Mon Sep 17 00:00:00 2001 From: realkaranvir <113927390+realkaranvir@users.noreply.github.com> Date: Tue, 10 Dec 2024 21:02:15 -0800 Subject: [PATCH 2/2] fixed triage submission --- public/js/triage/triage.js | 10 ++++++++-- public/js/triage/triageClientValidation.js | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/public/js/triage/triage.js b/public/js/triage/triage.js index 9ac8ce185..9c5e5c66f 100644 --- a/public/js/triage/triage.js +++ b/public/js/triage/triage.js @@ -391,8 +391,8 @@ var triageFields = { address: $('#address'), phoneNumber: $('#phoneNumber'), age: $('#age'),//doesn't work for an existing patient - years: $('#years'), - months: $('#months'), + years: $('#yearsInput'), + months: $('#monthsInput'), ageClassification: $('[name=ageClassification]'), city: $('#city'), maleButton: $('#maleBtn'), @@ -691,8 +691,14 @@ $(document).ready(function () { //checkIfDuplicatePatient(); checkIfDuplicatePatientMatch(); } + pass = !isDiabeticScreeningPromptNecessary; } + + if (pass === true) { + $('.triage-form').submit(); // Submit the form only if validation is successful + } + return pass; //located in triageClientValidation.js }); diff --git a/public/js/triage/triageClientValidation.js b/public/js/triage/triageClientValidation.js index 5c412239f..f77491482 100644 --- a/public/js/triage/triageClientValidation.js +++ b/public/js/triage/triageClientValidation.js @@ -34,7 +34,7 @@ var triageFieldValidator = { } //Validate Age - if ( (patientInformation.months.val().length > 0 && !integerCheck(patientInformation.months.val())) || + if ((patientInformation.months.val().length > 0 && !integerCheck(patientInformation.months.val())) || (patientInformation.years.val().length > 0 && !integerCheck(patientInformation.years.val())) ){ $('#ageClassificationWrap').children(".generalInfoInput").addClass("has-errors");