Skip to content

Commit 9b9dd46

Browse files
committed
HTML-872: Time component of encounter date widget should be set properly on form opening
1 parent eb1b3d1 commit 9b9dd46

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

api/src/main/java/org/openmrs/module/htmlformentry/widget/TimeWidget.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ public String generateEditModeHtml(FormEntryContext context, String fieldName, C
5151
.append("\" value=\"" + valAsCal.get(Calendar.HOUR_OF_DAY) + "\"/>");
5252
sb.append("<input type=\"hidden\" class=\"hfe-minutes\" name=\"").append(fieldName).append("minutes")
5353
.append("\" value=\"" + valAsCal.get(Calendar.MINUTE) + "\"/>");
54-
if (!hideSeconds) {
55-
sb.append("<input type=\"hidden\" class=\"hfe-seconds\" name=\"").append(fieldName).append("seconds")
56-
.append("\" value=\"" + valAsCal.get(Calendar.SECOND) + "\"/>");
57-
}
54+
sb.append("<input type=\"hidden\" class=\"hfe-seconds\" name=\"").append(fieldName).append("seconds")
55+
.append("\" value=\"" + valAsCal.get(Calendar.SECOND) + "\"/>");
5856
} else {
5957
sb.append("<select class=\"hfe-hours\" name=\"").append(fieldName).append("hours").append("\">");
6058
for (int i = 0; i <= 23; ++i) {
@@ -83,21 +81,23 @@ public String generateEditModeHtml(FormEntryContext context, String fieldName, C
8381
sb.append(">" + label + "</option>");
8482
}
8583
sb.append("</select>");
86-
if (!hideSeconds) {
87-
sb.append("<select class=\"hfe-seconds\" name=\"").append(fieldName).append("seconds").append("\">");
88-
for (int i = 0; i <= 59; ++i) {
89-
String label = "" + i;
90-
if (label.length() == 1)
91-
label = "0" + label;
92-
sb.append("<option value=\"" + i + "\"");
93-
if (valAsCal != null) {
94-
if (valAsCal.get(Calendar.SECOND) == i)
95-
sb.append(" selected=\"true\"");
96-
}
97-
sb.append(">" + label + "</option>");
98-
}
99-
sb.append("</select>");
100-
}
84+
sb.append("<select class=\"hfe-seconds\"name=\"").append(fieldName).append("seconds").append("\"");
85+
if (hideSeconds) {
86+
sb.append(" style=\"display:none\"");
87+
}
88+
sb.append(">");
89+
for (int i = 0; i <= 59; ++i) {
90+
String label = "" + i;
91+
if (label.length() == 1)
92+
label = "0" + label;
93+
sb.append("<option value=\"" + i + "\"");
94+
if (valAsCal != null) {
95+
if (valAsCal.get(Calendar.SECOND) == i)
96+
sb.append(" selected=\"true\"");
97+
}
98+
sb.append(">" + label + "</option>");
99+
}
100+
sb.append("</select>");
101101
}
102102

103103
return sb.toString();

0 commit comments

Comments
 (0)