I have a library with a couple of custom content types all inheriting from Document Set and in the edit form the Content Type field shows up. I would rather remove it because it doesn't make any sense for these items to change content type after they are created. I added<FieldRef ID="{c042a256-787d-4a6f-8a8a-cf6ab767f12d}" Name="ContentType" ShowInEditForm="FALSE"/>
to the content type and list definition, but it's still showing up. How do I remove the content type field from the edit form?
2 Answers
Setting ContentType
field property ShowInEditForm="FALSE"
will not affect the visibility of Content Type Choice control in the Edit form.
The visibility of Content Type Choice control (ChangeContentType class) is determined by the following conditions:
- whether content types are enabled for the list (SPList.ContentTypesEnabled property)
- the number of available content types for a list are more than 1
How to hide Content Type Choice control
One option would be to hide the control on the client-side:
$(function() {
$("select[id*='ContentTypeChoice']").closest('tr').hide();
});
Compatible with SharePoint 2010/2013
Go to List Settings -> Advanced Settings -> Allow management of content types?
Set this to No.
-
3This would remove content types from the library completely. The requirement is to disable the change of a content type in edit mode. Aug 11, 2015 at 12:30
-
@PaulStrupeikis I don't think it will remove the content types. It will just hide the ability to manage them and at the same time hide the option to change them from the Edit form. At least that is how it is working for me. Aug 11, 2015 at 12:42
-
It must be possible somehow because a Workflow Task does not show under the New option and neither on the Edit Form. But is listed as ContentType  Aug 11, 2015 at 13:55
-