Friday 22 June 2012

Disable SharePoint People Picker Control


 I got a task to disable/make people picker control column read-only in a SharePoint list editform.aspx page using jQuery. In my scenario, There are two People Picker Control and I need to disable only one.
After spending good amount of time, I got the solution as shown below:
//Load JQuery file
<script type="text/javascript" src="../../jquery/jquery-1.7.1.min.js"></script>

<script type="text/javascript">
$(document).ready(function() {

var columnName = 'Name';
var searchText = RegExp("FieldName=\"" + columnName + "\"", "gi");
$("td.ms-formbody").each(function() {
        if(searchText.test($(this).html())) {        
           $(this).find("div[Title='People Picker']").attr("contentEditable",false);
           $(this).find("a[Title='Check Names']").hide();
           $(this).find("a[Title='Browse']").hide();     
       }
   });
});
</script>


4 comments :

  1. It works for me thanks.

    ReplyDelete
  2. Thanks for your suggestion. I will definitely look fer this for future

    ReplyDelete
  3. Greatwebpage thiѕ is. I want to of a website that cɑn assist your site ѡith аll of its Internet Marketing requirements.
    Go to my name link. Thiѕ guy has helped my firm so
    much

    my site - social media marketing services

    ReplyDelete
  4. it is not working for me. I am using jquery 3.2

    ReplyDelete