Forum Discussion

Dan Barnett's avatar
Dan Barnett
Brass Contributor
Apr 01, 2019

Need to hide content type columns on Display form (SP2013)

I have a list that is mostly comprised of content types.  The requirements are:

  • to have all columns available on the NewForm and EditForm, but 
  • hide all but 2 columns on the DisplayForm.

Add'l Info:

  • All of the columns belong to Content Types (with most of the columns belonging to a single CT)
  • This is in SP2013

 

When I open the DispForm in SPD, I don't see where I can https://social.msdn.microsoft.com/Forums/en-US/f2537e08-469b-48a3-820f-75ae4f1abee6/how-to-hide-columns-from-sharepoint-list-display-form?forum=sharepointdevelopment.

I assume this is complicated because the columns are part of a CT.

 

How can I go about hiding the specific columns from the DispForm?

 

Thanks in advance!

1 Reply

  • shobhitbhalla's avatar
    shobhitbhalla
    Brass Contributor

    Hi Dan Barnett 

     

    Use the below Powershell, change your site URL and column Name

    Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
    #Get the Web
    $SPWeb = Get-SPWeb "http://testserver/sites/producttest"  
    #Get the List
    $SPList = $SPWeb.Lists["TestList"]
    #Get the Field
    $SPField = $SPList.Fields["ColumnTest"]
     
    #Hide from NewForm & EditForm
    $SPField.ShowInEditForm = $false
    $SPField.ShowInNewForm  = $false
     
    $SPField.Update()
    $SPWeb.Dispose()