Monday, December 31, 2012

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? Lets see various ways to Hide SharePoint List Columns.

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).

Using SharePoint Manager Tool to Hide SharePoint List Form Fields:
My favorite utility, SharePoint Manager is not just a Object Explorer but supports changing configurations also. So we can use SharePoint Manager to change the specific fields 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

PowerShell Script to Hide SharePoint List Columns:
SharePoint fields can be hidden programmatically. Why not PowerShell? Lets use PowerShell to set the field properties.
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#Get the Web
$SPWeb = Get-SPWeb ""
#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


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

  $SPSite = New-Object Microsoft.SharePoint.SPSite("")
  $SPWeb = $SPSite.OpenWeb()

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

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


Object Model C# Code to hide fields on a form:
       using (SPSite oSPSite = new SPSite(""))
                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;



 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

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: (Its not written by me, BTW!)
<script language="javascript" type="text/javascript">

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");"none";

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 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!

You might also like:
SharePoint Usage Reports
Usage reports, collaboration and audit for SharePoint.
Document SharePoint Farm
Automatically generate SharePoint documentation.

Check out these SharePoint products:


  1. 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

  2. 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?

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


Please Login and comment to get your questions answered!

You might also like:

Related Posts Plugin for WordPress, Blogger...