SharePoint Online: Show/Hide a Form Field based on Another Field’s Value using Conditional Formula

Requirement: Show or Hide a field based on another field’s value in SharePoint Online list form.

How to Show or Hide a Field based on Another Field in SharePoint Online?

In the past, we used to achieve this using jQuery Show or Hide SharePoint List Form Fields based on Another Field’s Value using jQuery. Now in SharePoint Online, we have Conditional Formulas Out of the box to achieve that functionality. Here is what we wanted: Show the “Project Classification” field only when the “Project Status” field value is set to “Yes”. Otherwise, hide it in the list Form. Here is how to configure conditional formula to show/hide columns based on other columns:

  • Go to your SharePoint Online list >> Open the New Item form by clicking on the “New” button in your list.
  • On the New item page, click on “Edit Form” button and then “Edit Columns” as in the below screen. sharepoint online hide column based on another column edit columns
  • Now, on the “Edit Columns” form, click on the three dots (:) and choose “Edit Conditional formula” from the menu. In my case, it’s the “Project Classification” field I want to show or hide.edit conditional formula in sharepoint online
  • In the conditional formula, Enter the formula to show and hide the field. In my case, I have entered “=if([$IsActive] == true, ‘true’, ‘false’)” and hit save to commit your changes. Be sure you are using Internal Names of the columns, instead of display name.set conditional formula in sharepoint online column
  • Now, the “Project Classification” field will be visible only when the “IsActive” field value is set to True!show or hide form field based on another field value in sharepoint online

The conditional formula must start with the “=” symbol followed by an “IF” condition. If the condition is satisfied, it returns true and that shows the field, else it returns false and hides the field.

Please note, not all columns are supported in conditional formulas as of today. E.g. Managed Metadata column, Person or group/choice with Multiple selections enabled, Currency columns, Location, Calculated columns, etc. are under the “Unsupported” list. Also, on columns marked as “Required”, we can’t apply conditional formulas to show or hide (that’s obvious, isn’t it?). Here are some examples:

Column TypeFormula Example
Yes/No (check box) – Boolean=if([$ProjectStatus]==’completed’,’true’, ‘false’)
Number=if([$Budget]>5000,’true’,’false’)
Choice=if([$Department]==’IT’,’true’, ‘false’)
Date=if([$StartDate]==Date(’01/01/20221′),’true’,’false’)
Person=if([$Approver].email==’[email protected]’,’true’,’false’)
Column with calculation=if([$Column1]+[$Column2]<5000,’true’,’false’)

More on conditional formulas in SharePoint Online List forms: https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/list-form-conditional-show-hide

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

Leave a Reply