Monday, July 21, 2008

How to hide a field in edit or new item form

I get this question a lot...

How can we hide a field from a specific user, or completely from the edit or new form?

Well the hard way (and SharePoint approved) would be to write some .NET code against the SharePoint API and changing the field visibility - I will not go into it now.

Other way - still hard, is to change the field CAML definitions (Xml files) - also for existing fields not recommended at all - I will not go into it now as well.

There is a much easier way, no code envolved, simply by adding a content editor web part to the page with some javascript that will hide the field content form the user.

It is not perfect, sure. It can be fooled, right.
But for those of you that just need it for cosmetic reasons mostly, this is the perfect solution.

I actually covered that in an older post, I just think its title was not clear enough - please follow this link for the complete how-to manual.

Thanks, Shai.


tbat said...

I am using another no-coding solution for hiding fields in my forms when needed. It is implemented in free forms builder engine - iTechnology Forms Accelerator
It's good Share Point based product. One of the things I am doing is exactly to hide some fields in my different views. It is made by built-in option called "Virtual Perspective" where managed by custom formula some fields are hided, some are shown. I think this is good approach and no-coding at all, what is the most precious for me!

Shai Petel said...


I was talking on a no-3rd-party solution.

The problem in your solution is that it takes forever to load, requires Silverlight - which is not supported in all browsers and OS's, and although you say it is no code - i did see some coded logic you have to build.

Also - it will destroy the support for custom fields types - taking us back to SharePoint 2003...

If you are interested in a much better solution by 3rd party (there are some) we have one called SLFE.

It delivers reall forms power, field level security, field grouping, custom field validators (email for example) and default values for all field types and much much more - and the best thing is you never leave your browser, it is all web based and cross browser / OS compatibel and works with all custom field types perfectly.

see it here

pmp exam time said...

It is very educational for me.