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. Hɑve you ever considered about including a little bit more than just your articles?

    I mean, what you say is valuаble and all. However think about if
    you adsded ѕome great graphics or video clips to give your postѕ more, "pop"!
    Your contеnt is excellent bbut with images and clips, this site
    could undeniably be one of the very bеst in iits field.
    Amazing blog!

    Here is my ѡeeblog invisalign vs braces time

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

    ReplyDelete
  4. 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