My 2p about ERP Solutions, Information Worker Solutions and other software products (mainly Microsoft Dynamics AX and Microsoft SharePoint).

01 August 2008

Hide list fields upon creation of a SharePoint list item

by Patrik Luca 9 comments

Tag



Business requirement: Hide list fields upon creation / modification of a SharePoint list item


Suppose you want to hide a SharePoint list field upon creation of a list item and to show it upon modification of that same list item. Suppose you want to hide another SharePoint list field upon modification of a list item and to show it upon creation of a list item in that same SharePoint list.
This is something which cannot be achieved by using merely the out-of-the-box administration tools of SharePoint.

Solution: use the SharePoint Tips Utility Pack


Ishai Sagi developped a great package of utilities which can be downloaded from CodePlex: SharePoint Tips Utility Pack. With this tool you can modify some of the field settings of a SharePoint list which cannot be modified in the regular SharePoint interface.

To start using the SharePoint Tips Utility Pack, you need to install it on your SharePoint server, as the tool will only run if installed directly on your SharePoint server. The installation is very straight forward, as it comes with a Microsoft Installer package (MSI).

To show the strength and functionality of the SharePoint Tips Utility Pack, create a Custom List (call it Custom List) in your SharePoint environment and add to it following Single line of text fields with default settings:
  • ShowOnlyUponCreation
  • ShowOnlyUponModification

If you created the SharePoint Custom List correctly, it should look like this:


By default, both fields ShowOnlyUponCreation and ShowOnlyUponModification will appear on both the NewForm.aspx and the EditForm.aspx pages.
We are going to modify in the next steps the SharePoint field settings as such that the ShowOnlyUponCreation field will only be visible upon creation of a new SharePoint list item. The ShowOnlyUponModification will only be visible upon modification of an existing SharePoint list item.

  1. Start the SharePoint Tips Utility Pack.

  2. Choose Lists Management, Change Field Settings.
  3. Enter the Site Url of your SharePoint server and choose Load.

  4. In the Choose List dropdown field, choose the value of our previously created SharePoint Custom List, being Custom List.
  5. In the Choose Field dropdown field, choose our previously created ShowOnlyUponCreation SharePoint field.
  6. Uncheck the checkbox Show In Edit Item Forms.
  7. Press the button Set Values.

  8. In the Choose Field dropdown field, choose our previously created ShowOnlyUponModification SharePoint field.
  9. Uncheck the checkbox Show In New Item Forms.
  10. Press the button Set Values.



When you create a new SharePoint list item in the Custom List, you will notice that the ShowOnlyUponModification SharePoint field is not visible anymore.


When you edit the SharePoint list item, you will notice that only the ShowOnlyUponModification SharePoint field will be visible.

Comments 9 comments
Anonymous said...

I just came across this post. Can you provide examples of when / why these fields would be useful?

Patrik Luca said...

This post is to provide you a way of showing different fields on the form for creating new list items versus the form for editing existing items: it has nothing to do with specific fields.

Anonymous said...

Very nice utility feature. Thank you for posting.

Anonymous said...

thanks patrik. This is super useful for me and the company. I set up a sharepoint list that we've been using to track software defects. Theres a lot of things on the form. Only a few fields needs to be filled in on "ADD" but other fields are required on EDIT.

reddy said...

HI Patrik,
Nice tool.I am wondering will this tool work for 'Custom List forms'.I tried to use it but didn't work.Can you help me on this?

Thank you,
reddy

Patrik Luca said...

What do you mean with a Custom List form? Do you mean a .aspx page such as the NewForm.aspx which is unghosted? Because I guess it won't work on unghosthed pages, but I am not sure (I've never tried it, since I try to avoid unghosting my pages)

Anonymous said...

You may also like...

http://weblogs.asp.net/sharadkumar/archive/2008/07/29/how-to-customize-sharepoint-forms-part-2.aspx

There is option to mark fields as Read only!

Anonymous said...

Nice !!!!!!!!

Hide columns in SharePoint, it is simple.

Try this too,
How to hide columns in SharePoint

Patrik Luca said...

I think the solution in my post is better than the one you suggest to try: the one you suggest is unghosting the EditForm.aspx page for example, which means, you'll run into troubles when you add afterwards new columns to your SharePoint list: you'll have to adapt each time your EditForm.aspx page. The solution of my blogpost doesn't has this problem.

Patrik Luca, Ieper, BELGIUM
Feel free to use or spread all of the content on my blog. In return, linking back to my blog would be greatly appreciated. All my posts and articles are provided "AS IS" with no warranties.

Subscribe feeds via e-mail
Subscribe in your preferred RSS reader

Subscribe feeds rss Most Read Entries

Subscribe feeds rss Recent Entries

Categories

Recommended Books


Subscribe feeds rss Recent Comments

This Blog is part of the U Comment I Follow movement in blogosphere. Means the comment field of this blog is made DOFOLLOW. Spam wont be tolerated.

Blog Archive

My Blog List

Followers

Links