This SharePoint tutorial explains, how to hide content type drop-down from SharePoint Online, which comes in edit form inside SharePoint online task list. The same solution will also work for SharePoint 2013 and SharePoint 2016.
Recently we were working in a visual studio 2015 workflow, there we have added the various custom content types into the task list.
If you are new to SharePoint workflow development, then check out the below SharePoint workflow tutorials:
- Step by Step Nintex Workflow tutorial for Office 365 SharePoint Online
- Document Approval Workflow in Nintex Workflow for Office 365 SharePoint Online
- SharePoint designer workflows: Create your First Workflow using SharePoint designer 2013
- Deploy SharePoint 2013 designer workflow into production in SharePoint online
- SharePoint designer 2013 Workflow: Assign task to a group using Assign a task workflow action
- How to send email to SharePoint group in visual studio 2015 workflow in SharePoint hosted add-in SharePoint online?
- Step by step develop workflows using visual studio 2015 as an add-in and deploy to host web in SharePoint online
By default whenever a task got created and a user wants to approve/reject the task from the edit form, the content type dropdown appears like below:
As per the requirement, we need to hide the content type drop down from the task list edit form.
Hide content type dropdown
We can hide the content type drop-down by using below jQuery code in SharePoint Online/2013/2016.
Either we can put the code inside the Edit form task list or we can also put inside master page.
To put inside the page, Edit the page -> And then add a script editor web part. Inside the script editor web part put the below code. Once you Save the page and refresh it will hide the dropdown.
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$("select[id*='ContentTypeChoice']").closest('tr').hide();
});
</script>
Similarly we can put the code inside a master page. But since when you put the code inside master page, it might hide every list, so I had added one condition like below:
- First retrieve the browser URL like : var pageURL = $(location).attr(“href”);
- Then if the URL contains the list URL then only it will hide.
if( pageURL.indexOf('/WorkflowTasks/') >= 0)
{
}
The full code like below:
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function () {
var pageURL = $(location).attr("href");
if( pageURL.indexOf('/WorkflowTasks/') >= 0){
$("select[id*='ContentTypeChoice']").closest('tr').hide();
}
});
</script>
Once you put the above code inside the master page, it will hide the content type.
You may like following SharePoint task list tutorial:
- How to open directly workflow task list edit form in the SharePoint task list?
- SharePoint Online Gantt Chart View for Task List
- SharePoint online task list form Approve Reject button disappears visual studio 2015 workflow
- SharePoint designer 2013 Workflow: Assign task to a group using Assign a task workflow action
- How to use Start a Task Process Action in Nintex Workflow for Office 365 SharePoint Online
- Open SharePoint task list form in edit mode by default
- Change due date for Task list in SharePoint designer 2010 workflow
- Different ways to show/hide SharePoint List form fields
- Workflow Task and History List are not found an error in SharePoint 2013 or SharePoint 2010
- How to add edit task form URL inside SharePoint 2013 designer workflow email?
I hope this SharePoint tutorial explains, how to hide SharePoint Online/2013/2016 content type dropdown in task list edit form using jQuery.
Tags: SharePoint hide content type, SharePoint hide content type in the edit form, SharePoint 2013 hide content type in edit form, SharePoint 2013 hide content type field in the edit form, SharePoint online hide content type in task list edit form.
Hello Everyone!! I am Bhawana a SharePoint MVP and having about 10+ years of SharePoint experience as well as in .Net technologies. I have worked in all the versions of SharePoint from wss to Office 365. I have good exposure in Customization and Migration using Nintex, Metalogix tools. Now exploring more in SharePoint 2016 🙂 Hope here I can contribute and share my knowledge to the fullest. As I believe “There is no wealth like knowledge and no poverty like ignorance”