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.

allowmanagementofcontenttypes

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. 

 listsettingscontenttype

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.

contenttypecolumns

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.

changelistcontenttypecolumn

As I mentioned earlier there is a way to do this with PowerShell. By doing it programmatically you can part from the Content Type way just described decide which fields that should be visible individually between the NewForm.aspx and the EditForm.aspx. Since this solution is made by our PowerShell Guru I will simply link to his article and hope that this post was useful for you.



  1. [...] field. Mattias Karlsson, a friend of mine, describes a step-by-step on achieving this on his blog. In this Post, I’m going to describe how to do it through PowerShell. First make a connection [...]

  2. Deb Weathewax on Friday 16, 2009

    Thank you, thank you, thank you. Worked perfectly!!!

  3. BostonMike on Friday 16, 2009

    This works great but I have a situation where I need to hide the Name field in the EditForm in a document library. We dont want users to change a file name once it has been uploaded. Because the Name field is a required field and is part of the parent Document content type it has no way to get to the options screen to choose to hide it. Any suggestions here?

  4. Mattias Karlsson on Friday 16, 2009

    Hi,

    I did some consulting with Niklas Goude and we found out that it works if we do it with PowerShell (maybe this will be a separate post later on).

    Use the following code in PowerShell

    $SPSite = New-Object Microsoft.SHarePoint.SPSite(“http://yoursite”)

    $OpenWeb = $SPSite.OpenWeb(“/your site”)

    $List = $OpenWeb.Lists["Name of your list"]

    $UserAgent = $List.Fields["Name of your column"]

    $UserAgent.ReadOnlyField = $True

    $UserAgent.Update()

    This will make the field to now even show up in the edit form but you are able to use it in views etc.

    Hope this works for you

  5. BostonMike on Friday 16, 2009

    It sure did work…like a charm. thank you very much!

  6. Radha on Friday 16, 2009

    Vat if I want to hide a field Content Type from :EditPage.aspx page
    If I attach a folder content type to a folder and when I say new item I get to select a content type option, provided I want to freeze it to my own created folder content type or just remove the content type field permanantly from the page .
    Is der any way to solve it?

  7. Elliot on Friday 16, 2009

    This is excellent stuff – thanks for posting.

    A question I have is how to use this feature (or something similar) to display different fields on different Edit pages? What I am trying to do is provide various ways of editing the same list where different edit pages present the user with different data fields – but all are from the same list. For example, my list contains fields 1 through 10 and I want user A to only edit fields 1-3 and user B to only edit fields 4-10.

    The flexibility I have is limited as unfortunately SharePoint Designer is not available at my company (I am just a user of an enterprise level implementation).

    I think this may be possible via Data-Sheet views, but I’m a little reluctant to use Data-Sheet views as I’ve had issues with them in the past.

  8. Mattias Karlsson on Friday 16, 2009

    Hi Elliot,

    Unfortunately there is now way to handle this out of the box. The most solid way would be to build a web part that has integrated support for checking what fields the user should have. You could then create different SharePoint groups to put the users in and check towards, however this needs some custom coding.

    The datasheet views does not give you a full proof way lock down the fields for some users. The same goes for if you create multiple edit form fields and then with PowerShell make the different fields hidden and direct the users to the different forms.
    Since it seems like you do not have admin rights, unfortunately none of the above suggestions are an option for you. I would recommend talking to you IT department and check the opportunities to create a custom edit form.

  9. shafaqat on Friday 16, 2009

    hi
    i want to show and hide fields depending upon the user group, if a user is a part of Group A, he should see some fields but if a user is not part of Group A, he should not see some specific fields of a List. i am not using custom list, i am using simple list of type “tasks”
    is it possible to achieve this?

  10. Mattias Karlsson on Friday 16, 2009

    Hi,
    This is a common question and something many organizations have on their wish list for Office 14. Unfortunately it’s not possible out-of-box with either WSS 3.0 or Moss. To be able to do this you need to create some kind of web part that render the form fields for you and where you can connect the field towards a group. That web part will then replace the one uses in the newform.aspx and editform.aspx. I have not seen any free web part like this but I think that we at Zipper has made something similar in some project so if you want I can get back to you and we can see if we can find some kind of arrangement.

  11. shafaqat on Friday 16, 2009

    hi
    thanx for your timely reply.
    check out this solution
    http://www.sharepointboost.com/columnpermission.html
    but expensive.

  12. Mattias Karlsson on Friday 16, 2009

    Looks solid. Something to extend the article with maybe. Thanks

  13. shafaqat on Friday 16, 2009

    i am looking closely that how user or group could be bound to list fields, if you find something related to it, please share.

  14. reddy on Friday 16, 2009

    I have similar situation on the column level permission

    I want a field in the form to be visible based on the selection in other fields

    i.e field 1 drop down list with options -( option 1, option2)
    field 2 drop down with options ( selection 1, selection 2)

    field 3 is supposed to be shown only when some one selects field1-option 2 & field2-selection2

    is this possible through custom code or any validators in sharepoint designer .

    Please help

  15. Litehouse on Friday 16, 2009

    Awesome!!! This was exactly what I needed, I have been looking for this solution forever.

  16. Joshua Francis on Friday 16, 2009

    Hello,
    I have a SharePoint custom list with several fields. It is an action log tracking system. I want the admin. to enter action items and assign to the respective users to update status and comments of the item. The first part works well out of the box, but I want when the specific user opens up the form to edit their items, only the status and remarks field are editable. All other fields are ‘read only’. Further to this, the admin can open an edit form and see all fields as editable and not just status and remarks. How can this be accomplished? Thanks in advance.

  17. Mattias Karlsson on Friday 16, 2009

    Hi,

    There is unfortunately no out of the box features to use to accomplish this very common request, you are not alone :) It can however be made through custom coding. I thing that came to my mind right now and that I have not tested myself is if it would be possible with javascript to put the fields in read only through SharePoint designer. This step I’m quite sure works if you just know the names of the fields. Next step would be to wrap this into some kind of control looking up the users. As I said, I have not tested thism don’t know if it works and should be seen as a fairly “dirty” solution. I’ll see if I can find the time to investigate my thoughts further and if you find something out please let me know.
    /Mattias

  18. James Scrivener on Friday 16, 2009

    Perfect post exactly what I needed.

    It was suggested to me to use some javascript in in the page but this is so much easier!

  19. maajka on Friday 16, 2009

    wow this is amazing, I have been looking for ways to get this done for 6 months now and have been to alot of different forums and help sites but NONE offered a simple solution like this and most relied on scripts that hide fields…I don’t understand why you seem to be the only person on the internet to offer this easy solution, THANK YOU!

  20. Bob Cedric on Friday 16, 2009

    There another great solution for it.
    we are using Infowise Smart List Pro which can run on both WSS 3.0 and MOSS 2007 (Has a SharePoint 2010 version also).
    Smart List Pro extend the SharePoint lists & document libraries, and gives them abilities like – field/column permissions based on rules , default values, view permissions, tabbed interface and much more.

    check it out- http://www.infowisesolutions.com/product.aspx?id=SmartListPro

  21. [...] Hide form fields in SharePoint | My SharePoint of View – 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. [...]



Subscribe without commenting