Make People Picker read only in SharePoint 2010 list form using jQuery

InfoPath alternatives for form designing SharePoint

In this post we will discuss how we can make people picker control read only in SharePoint 2010 list form (Edit Form) using jQuery.

Read some SharePoint tutorials
SharePoint online: Ultimate tutorial guide PDF download

Get manager of current SharePoint user using SPServices and GetUserProfileByName

Cascading dropdownlist in SharePoint 2010 list using jQuery

Below is the jQuery code:




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

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

$(document).ready(function () {

var control = $(“textarea[title=’People Picker’]”)[0];

/* Detect browser*/

if (navigator.appName == ‘Microsoft Internet Explorer’) {

control.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[1].style.display = “none”;

}

else {        control.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.childNodes[2].style.display = “none”;

}

var innerHtml = control.parentNode.parentNode.innerHTML;

control.parentNode.style.display = “none”;

control.parentNode.parentNode.parentNode.parentNode.parentNode.innerHTML = control.parentNode.parentNode.parentNode.parentNode.parentNode.innerHTML + “<span class=’fieldsTitle’>” + $(‘.ms-inputuserfield #content’).text() + “</span>”;

});

</script>

Before this jQuery the People Picker was like this:

Make People Picker read only in SharePoint 2010 list form using jQuery
Make People Picker read only in SharePoint 2010 list form using jQuery

After implementaion it looks like below:

Make People Picker read only in SharePoint 2010 list form using jQuery
Make People Picker read only in SharePoint 2010 list form using jQuery

Hope this will be helpful.

Similar SharePoint 2013 Tutorials


About Sagar Pardeshi

I am Developer working on Microsoft Technologies for the past 6+years. I am very much passionate about programming and my core skills are SharePoint, ASP.NET & C#,Jquery,Javascript,REST. I am running this blog to share my experience & learning with the community I am an MCP, MCTS .NET & Sharepoint 2010, MCPD Sharepoint 2010, and MCSD HTML 5,Sharepoint 2013 Core Solutions. I am currently working on Sharepoint 2010, MOSS 2007, Sharepoint 2013,Sharepoint 2013 App Dev, C#, ASP.NET, and SQL Server 2008.

View all posts by Sagar Pardeshi →

Leave a Reply