Monday 31 October 2011

Hide form fields in SharePoint (Issue Tracking List)

Sometimes when building SharePoint solutions or creating custom lists you want to hide some columns from the new or edit form. But the default new and edit form are automatically generating the form fields with all the columns that are created for the list.
This can be done in three different ways. The first way to do this is to use SharePoint Designer and make a custom form field, there are a couple of good articles about this (but you should be aware of that this could in some cases cause problems with e.g. attachments not working properly without extra coding). The second way, and the easiest way, is with content type as I will guide you through today. This might on the other hand be the least flexible. The last way is by using PowerShell which I will get back to later in the article.
Start by going to your list that you want to modifye the form fields on, this could be any kind of list or library. In the list go to List Settings and then click on the Advanced List settings.
What you first need to do is to allow management of Content Types. Click on Yes and then Ok.
You will then return back to the List Settings page which now looks a bit different. You will see a new section called Content Type. In my example I have used an Issue list so what I have is the Content Type Issue like shown in the picture below. 

What you see now is a list of all the Site Columns that is connected to the Content Type Issue. This could have been any kind of Content Type, default or custom made that has default or custom made Site Columns.
By clicking on any of the columns you are able to do some modifications to the column. In the Column Settings section you have three options. Required, Optional and Hidden. By Selecting Hidden the form field will not show up in forms. You should however note that this makes the form field hidden both in the NewForm.aspx and the EditForm.aspx forms.

1 comment:

  1. Is there any way to make it hide the columns on the NewForm.aspx, but NOT the EditForm.aspx?

    ReplyDelete