Hide Content Type Field On Edit Form In SharePoint 2016

SharePoint Disable and Hide Content Type Field On Edit Form

In this post, we will learn How to Hide Content Type Field on Edit Form In SharePoint 2016 / 2013.

Hide Content Type Field On Edit Form In SharePoint

You might also like to read Show / Hide fields based on choice field selection using JQuery in SharePoint


SharePoint 2016: Hide Content Type Field On New Form

I have a custom list “Project Tasks” with content type enabled, I would like to Hide the Content Type Field when editing the list item.

Hide Content Type Field On Edit Form In SharePoint

Actually, we can Show and Hide Columns in SharePoint List Forms Using PowerShell in edit form/display form / new form as shown below

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$web = Get-SPWeb -Site http://debug.to/
$listname = "Project Tasks"
$fieldName = "Content Type"
$list = $web.lists | Where-Object { $_.title -Eq $listname } 
$list | Format-Table title,id -AutoSize
$field = $list.Fields[$fieldName] 
$field.ShowInEditForm=$false;
$Field.Update()

But, you should be aware of we can’t hide the system generated column like “Content-Type” using the PowerShell.

In this case, the available alternative solution is using the JQuery to hide SharePoint Content Type Field on Edit and New Form.

Hide Content Type Field On Edit Form Using JQuery

In this section, we will show how to Hide Content Type Field On Edit Form and New Form Using JQuery In SharePoint 2016/2013.

Steps

  1. Open your list.
  2. From the above ribbon, Click on the List tab.
  3. In “Customize List”, Click on “Form Web Parts”.
  4. Select “Default Edit Form” to customize the default edit form.
Default Edit Form in SharePoint
  • Click on Add new Web Part.
  • In the “Media and Content” category, Add Script Editor web part.
  • Edit the snippet.
Add Script Editor in SharePoint 2019

Add the below code:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
//  Hide content type column on edit form
  $("select[title='Content Type']").closest('tr').hide(); 
}); 
</script>

No need to add the JQuery reference if you have already added to your custom Master Page.

  • Stop Editing your page.
  • Go back to edit your item.
  • The Content-Type Column would be hidden successfully as shown below.
Remove Content Type Column In Edit Form In SharePoint

Disable Content Type Column On Edit Form Using JQuery

Besides, hide content type column SharePoint using JQuery, you can also disable content type SharePoint column on Edit Form Using JQuery as shown below:

Disable Content Type Column In Edit Form In SharePoint

Steps

  1. Open your list.
  2. From the above ribbon, Click on the List tab.
  3. In “Customize List”, Click on “Form Web Parts”.
  4. Select “Default Edit Form” to customize the default edit form.
Default Edit Form in SharePoint
  • Click on Add new Web Part.
  • In the “Media and Content” category, Add Script Editor web part.
  • Edit the snippet.
Add Script Editor in SharePoint 2019
  • Add the below code:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
//  Disable content type column in edit form
  $("select[title='Content Type']").attr('disabled', 'disabled');
}); 
</script>
  • Stop Page Editing.
  • Open your list, Try now to create or edit an existing item.
  • The SharePoint Content Type Column should be disabled on Edit form now as shown below:
Disable Content Type Column On Edit Form In SharePoint

Applied To

  • SharePoint 2019.
  • SharePoint 2016.
  • SharePoint 2013.

Conclusion

In conclusion, we have explained How to

  • How to Hide Content Type column on Edit form in SharePoint using JQuery?
  • How to Disable Content Type column on Edit form in SharePoint using JQuery?

Download

You can also explore other JS snippet SharePoint on GitHub. Please, don’t forget to Follow Me to get the latest updates.

You might also like to read

Have a Question?

If you have any related questions, please don’t hesitate to ask it at deBUG.to Community.

4 thoughts on “Hide Content Type Field On Edit Form In SharePoint 2016”

  1. Pingback: Disable SharePoint Field in Edit Form | SPGeeks

  2. Pingback: Set Field as Read-only in Edit Form In SharePoint – IT Core

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top