Skip to content

Commit 2c02a05

Browse files
committed
#13505 - Fixed binding error for health conditions form
- `HealthConditionsForm` Unbound hidden fields on inaccessible check.
1 parent 201aaf9 commit 2c02a05

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

sormas-ui/src/main/java/de/symeda/sormas/ui/clinicalcourse/HealthConditionsForm.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535
import static de.symeda.sormas.ui.utils.LayoutUtil.locs;
3636

3737
import java.util.Arrays;
38+
import java.util.HashSet;
3839
import java.util.List;
3940
import java.util.Set;
41+
import java.util.stream.Collectors;
4042

4143
import com.vaadin.ui.CustomLayout;
4244
import com.vaadin.ui.Label;
@@ -251,10 +253,18 @@ protected <F extends Field> F addFieldToLayout(CustomLayout layout, String prope
251253
}
252254

253255
public void setInaccessible() {
254-
fieldsList.stream().forEach(field -> {
255-
getContent().getComponent(field).setVisible(false);
256+
final HashSet<String> disableFields = new HashSet<>(fieldsList);
257+
disableFields.add(OTHER_CONDITIONS);
258+
final List<Field<?>> fields = disableFields.stream()
259+
.map(e -> getContent().getComponent(e))
260+
.filter(f -> f instanceof Field<?>)
261+
.map(f -> (Field<?>) f)
262+
.collect(Collectors.toList());
263+
fields.forEach(field -> {
264+
field.setVisible(false);
265+
getFieldGroup().unbind(field);
256266
});
257-
getContent().getComponent(OTHER_CONDITIONS).setVisible(false);
267+
258268
Label confidentialLabel = new Label(I18nProperties.getCaption(Captions.inaccessibleValue));
259269
confidentialLabel.addStyleName(CssStyles.INACCESSIBLE_LABEL);
260270
getContent().addComponent(confidentialLabel, CONFIDENTIAL_LABEL_LOC);

0 commit comments

Comments
 (0)