Hide Columns in SharePoint List NewForm, EditForm and DispForms

Had a requirement to hide a specific column “Parent Project” in a SharePoint list “Project Metrics”, Since this field was being updated by an internal workflow, it must not be visible in NewForm or in EditForm.

So to protect a particular column from edits, decided to hide it from New & Display Forms. Here are the various methods I’ve used in different scenarios.

SharePoint SPField Object has the following properties to control its visibility.

  •     ShowInNewForm – Show in the list settings page
  •     ShowInEditForm – Controls field in edit form page
  •     ShowInDisplayForm –Show in the display form page.
  •     ShowInListSettings – Show in the list settings page
  •     ShowInViewForms –Show field in views field selection
  •     ShowInVersionHistory – Show in the version history view

These field properties are self-explaining, isn’t it? Let’s see various ways to Hide SharePoint List Columns.

Option 1: Enable Content Type and Hide the Field

This will hide the field from All list forms – NewForm, EditForm and DispForm.

  • Go to List Settings and enable content type by clicking “Advanced settings” and then choose “Yes” for “Allow management of content types?”.
  • Once done, You see “Content Types” in list settings. Click on “Item” link.sharepoint hide field
  • Select the Field to hide
    sharepoint hide columns on form
  • Choose “Hidden” under column settings.

sharepoint hide column in list
This will hide the selected field from ALL List forms (NewForm, EditForm and DispForms).

Option 2: Using SharePoint Manager Tool to Hide SharePoint List Form Fields:

My favorite utility, SharePoint Manager is not just an Object Explorer but supports changing configurations also. So we can use SharePoint Manager to change the specific field’s properties. Just download the SharePoint Manager, navigate to the field all the way through Web Applications, Site Collections, Sites, Lists. Set the “ShowInDisplayForm” or whatever required and save the changes.
sharepoint list hide a columnm with SharePoint Manager

Option 3: PowerShell Script to Hide SharePoint List Columns

SharePoint fields can be hidden programmatically. Why not PowerShell? Let’s use PowerShell to set the field properties.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get the Web
$SPWeb = Get-SPWeb "https://sharepoint.crescent.com"
#Get the List
$SPList = $SPWeb.Lists["Project Matrics"]
#Get the Field
$SPField = $SPList.Fields["Parent Project"] 

#Hide from NewForm & EditForm
$SPField.ShowInEditForm = $true
$SPField.ShowInNewForm  = $false

$SPField.Update()
$SPWeb.Dispose()

Same code goes in MOSS 2007 also, with slight change to hide list field in SharePoint 2007:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

$SPSite = New-Object Microsoft.SharePoint.SPSite("https://sharepoint.crescent.com")
$SPWeb = $SPSite.OpenWeb()

$SPList = $SPWeb.Lists["Project Matrics"]

$SPField = $SPList.Fields["Parent Project"]
$SPField.ShowInNewForm = $False
$SPField.ShowInEditForm = $False
$SPField.Update()

$SPSite.Dispose()

Object Model C# Code to hide fields on a form:

using (SPSite oSPSite = new SPSite("https://sharepoint.crescent.com"))
{
	using (SPWeb oSPWeb = oSPSite.OpenWeb())
	{
		 //Get List & Field
		SPList oSPList = oSPWeb.Lists["Project Metrics"];
		SPField oSPField = oSPList.Fields["Parent Project"];

		oSPField.ShowInEditForm = true;
		oSPField.ShowInNewForm  = true;

		oSPField.Update();
	}
}

Before hide column from SharePoint list: Parent Project

sharepoint list hide a column

After hiding column from list form page:
sharepoint 2010 hide list column

Option 4: Using JavaScript to Hide Form Fields

Just edit the List form page by appending ?toolpaneview=2 at the end. Add a CEWP to the page, place this JavaScript code:

<script language="javascript" type="text/javascript">
_spBodyOnLoadFunctionNames.push("HideColumns");

function GetControl(FieldName) 
{
   var arr = document.getElementsByTagName("!");

   for (var i=0;i < arr.length; i++ )
   {
      if (arr[i].innerHTML.indexOf(FieldName) > 0) {
          return arr[i];     
      }
   }
}

function HideColumns()
{
   var control = GetControl("Parent Project");
   control.parentNode.parentNode.style.display="none";
}
</script>

Hide SharePoint list column with jQuery:

This can be done using jQuery as well. Here is my post on How to hide SharePoint list form field using jQuery?

Do not hide a required field, or else you will not be able to Save list item!

Another alternate would be editing the Form page in SharePoint designer and set “Hidden” property for a relevant field, or even conditional format to hide a filed also will work.

There is a project in Codeplex: Office Toolbox, provides interface for hiding SharePoint list columns/fields from interface. Check it out!

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

5 thoughts on “Hide Columns in SharePoint List NewForm, EditForm and DispForms

  • thank you for explaining the ways to hide fields so clearly and step by step. It worked for me! I used the first method.

    Reply
  • Hi, This is exactly what I am looking. However, I am looking to hide multiple fields. Could you please let me how can I acheive this?

    Reply
    • The content type method would let you hide as many fields as you wanted. Just select each field and set each one to hidden

      Reply
  • Hi,

    I used above code to hide a peoplepicker in SP 2013. but i found one issue.
    if people picker is not having value, it works fine. but if it contains a value, it gives me java script error says “Invalid Argument” clientpeoplepicker.js

    Could you please help me to resolve this

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *