Skip to content

Commit 564bd31

Browse files
author
Alexis Girault
committed
Automatically select in the form if only one option
1 parent de00c86 commit 564bd31

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

examples/Dicom/src/dicomForm.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ function setupDicomForm(patients, callback) {
3636
const value = study.metaData.StudyDescription + " - " + study.metaData.StudyDate
3737
studySelect.options[studySelect.options.length] = new Option(value, value);
3838
}
39+
40+
if (studyList.length === 1) {
41+
studySelect.selectedIndex = 1
42+
studySelect.onchange()
43+
}
3944
}
40-
patientSelect.onchange(); // reset in case page is reloaded
4145

4246
studySelect.onchange = function () {
4347
// Remove options
@@ -55,6 +59,11 @@ function setupDicomForm(patients, callback) {
5559
const value = serie.metaData.SeriesDescription + " - " + serie.metaData.Modality
5660
serieSelect.options[serieSelect.options.length] = new Option(value, value);
5761
}
62+
63+
if (serieList.length === 1) {
64+
serieSelect.selectedIndex = 1
65+
serieSelect.onchange()
66+
}
5867
}
5968

6069
serieSelect.onchange = function () {
@@ -65,6 +74,11 @@ function setupDicomForm(patients, callback) {
6574
const serie = serieList[serieId]
6675
callback(serie)
6776
}
77+
78+
if (patientList.length === 1) {
79+
patientSelect.selectedIndex = 1
80+
}
81+
patientSelect.onchange(); // reset in case page is reloaded
6882
}
6983

7084
export default setupDicomForm;

0 commit comments

Comments
 (0)