Reader Level:
Articles

How to Hide the Content Type in Edit Form in SharePoint

By Sagar P on January 07, 2014
This article is about hiding fields in the Editform, SharePoint and how you can use jQuery to hide the content type field in an Editform.
  • 0
  • 0
  • 4845

Introduction

This article is about hiding fields in the Editform, SharePoint and how you can use jQuery to hide the content type field in an Editform.
 
So, click on "Add a Web Part" so that we can add a "Content Editor" web part to the form. This is where our JavaScript code goes.

Content Editor

Code
 
Contrary to the other fields, we have no NOBR tag here. We do have a form label and a select field.

So instead of referencing a field, we will reference the id of the selected field. That id contains a big id number, but also the text “ContentTypeChoice”.

Add code in Content Editor

<script language="javascript" src=" /JSLibrary/jquery-1.9.0.min.js" type="text/javascript"></script>

<script language="javascript" type="text/javascript">

    $(document).ready(function () {

        $("select[id*='ContentTypeChoice']").closest('tr').hide();

    });

</script>

Content Type Tool

Content Title

Summary

In this article we explored  the use jQuery to hide the content type field in an Editform.

Sagar P

I have 4+ yrs of experience. I am an MCP, MCTS .NET & Sharepoint 2010, MCPD Sharepoint 2010, and MCSD HTML 5.  I am currently working on Sharepoint 2010, MOSS 2007, Sharepoint 2013, C#, ASP.NET, and SQL Server 2... Read more

COMMENT USING

Trending up