
In this blog post I am going to show you that to show or hide fields on a list form based on the valued from other columns using JSON formatting. JSON is a very powerful way of formatting a SharePoint list/library form where you can also apply conditional formatting based on selected values in a list form on the run time. Follow my blog post on formatting details on SharePoint list forms for more details.
Scenario
I have a custom Patient info list which is used to takes the patient information. There are two column Patient History and History Details. Patient History is Boolean field and if its yes then show the History Details field, otherwise History Detail field should not be visible.
Implementation
Select any list item / document from the SharePoint list or library and expand the Edit Form button click on the Edit Columns.

This will show you complete list of Columns from the list, you can hide few columns form here and can change the order of the columns. Click on the three dots next column name and select Edit conditional formula.

A dialog will be opened, now you need to enter a formula to hide the field if Medical History option is selected.
=if([$MedicalHistory] == true, 'true', 'false')

Here I am applying the formula on a Boolean field, you can change the formula based on field type. And you can add multiple formulas based on your business need. Now on my form, when I am adding or editing a list item, the History detail field is not showing if the medical history field is not selected.
No Comments