diff --git a/rapids/templates/rapids/rapid_form.html b/rapids/templates/rapids/rapid_form.html index c213de21..6b4f7d15 100755 --- a/rapids/templates/rapids/rapid_form.html +++ b/rapids/templates/rapids/rapid_form.html @@ -33,7 +33,7 @@ function getUnusedInputs(inputs) { new_inputs = []; for (let i = 0; i < inputs.length; i++) { - input = inputs.get(i); + input = inputs.get(i); if (!input.value) { new_inputs.push(input); @@ -458,14 +458,16 @@ console.log("STUDY", study_description); // try to match with a study description - option = $(`#id_examination_from option[title*='${study_description}' i]`); + if ($(`#id_examination_from option`).length < 1) { + option = $(`#id_examination_from option[title*='${study_description}' i]`); - if (option.length) { - option.appendTo($("#id_examination_to")); - toastr.success(`Examination set to ${option.attr('title')} from dicom data`); - } else { - toastr.warning(`Unable to set examination ${study_description} from dicom data (it needs creating)`); + if (option.length) { + option.appendTo($("#id_examination_to")); + toastr.success(`Examination set to ${option.attr('title')} from dicom data`); + } else { + toastr.warning(`Unable to set examination ${study_description} from dicom data (it needs creating)`); + } } }