.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> SharePoint >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Read only People Picker Fields in SharePoint List Forms(editform.aspx) Jqury

Posted By:Sagar Pardeshi       Posted Date: December 24, 2013    Points: 200    Category: SharePoint    URL: http://www.dotnetspark.com  

Read only People Picker Fields in SharePoint List Forms(editform.aspx) Jqury
 

Introduction

How to Make SharePoint List Column (Form Field) Read Only, There are questions on disabling (or making them read-only) People Picker, Lookup Fields in SharePoint List Forms. Here I'm sharing the jQuery scripts to disable people picker / Lookup fields in SharePoint list forms (EditForm.aspx).

 

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:

 

 

In this way I was able to disable/ Read Only a People Picker control in a Sharepoint editform.aspx list form.

Hope it will be a help to you!


 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend