How to get groupbox to stay invisible

Hi there,

I have this code to make two groupboxes visible or invisible depending on the value of the field “brutoloon”. The problem i encounter is that when i save the record the groupboxes disappear nicely depending on the value of the field “brutoloon”, but after reopening the record the groupbox that is supposed to disappear, appears again. So the record is saved, but without this action. How can i get the record to save and also keep the groupbox invisible?

This is my code:

protected boolean postCommit(boolean committed, boolean closeWithCommit) {

        BigDecimal brutoloon = getItem()
        if (brutoloon.compareTo(getItem().getSolidariteitLoongrens()) >= 0) groupBox2223.setVisible(true);
        if (brutoloon.compareTo(getItem().getSolidariteitLoongrens()) >= 0) groupBox2.setVisible(false);
        if (brutoloon.compareTo(getItem().getSolidariteitLoongrens()) < 0) groupBox2223.setVisible(false);
        if (brutoloon.compareTo(getItem().getSolidariteitLoongrens()) < 0) groupBox2.setVisible(true);

        return super.postCommit(committed, closeWithCommit);

Any help would be welcome.

Regards LS

All components are visible by default. Changing the component visibility using the setVisible() method is applied only until the screen is closed, so you need to make the check and visibility setup during each screen opening in onInit() method instead postCommit() method.

If you want to change visibility after changing the value of “brutoloon” field during record editing, use ItemPropertyChangeEvent.


1 Like