Blog

Forms - How to hide fields that are blank, or have not been completed

Screens that display many fields can look messy when many of the values are incomplete or empty. We can tidy up the appearance of these screens by hiding empty fields, and this post describes how to carry out this task.

There are sometimes cases where it's necessary to show records that contain a large number of fields, and many of these fields may not have not been completed, or are empty.

In these circumstances, we can tidy up the appearance display screens by using a form control, and configuring the cards to not to show if the associated data value is empty.

This is one of the benefits of using a form. When we hide a card, the layout of the form automatically adjusts and unlike the alternative method placing controls directly on a screen, there will not be any gaps in the areas where the data values would have appeared.

To give an example, let's take the example of a list that shows property details. As this screenshot shows, several of the fields have not been completed.



To hide the fields that are not blank, we can go through each card on the display form and we can set the visible property to hide the card, if the associated data value is blank. As an example, here's the formula that we would apply to the postcode card. We would apply the same logic to the remaining cards on the form.

 

Not(IsBlank(ThisItem.Postcode))


How the form looks at runtime

If we run the app open a record with missing values, we can see that the form completely hides the label and card.


If we open another record with more values that have been completed, we can see that the display form correctly displays all completed fields.

Conclusion

To tidy up the appearance of screens that display a record, we can hide empty fields by using a form and hiding the cards that correspond to fields that are blank.