Form hide fields if value is null and set background to normal color

Is there some sort of way to iterate through a form and for each field if it is null set visible=false

something like

myForm.getFields().forEach( field -> {
 if (field.getValue == null){
field.setVisible(false)
}
})

Probably be a good feature to have in the designer Form -> properties …? e.g. Hide if null

And also, would anyone know the mixin to change an “Editor Disabled” form / fields background color back to normal? I do not want a greyed out background on some forms.

Cheers

The following code should work for you:

    for (Component component : form.getComponents()) {
        if (component instanceof Field) {
            if (((Field) component).getValue() == null) {
                component.setVisible(false);
            }
        }
    }
1 Like

Awesome.

Thanks!