Recently I  came upon a requirement where the client  wanted the People Picker field to populate automatically with a user name depending on the some criteria and  not be able to change it.
I know I can disable the field but with the “Browse” icon a user can still change the People Picker value.
 So in order to hide the “Browse” field I went on a journey to figure out and finally found an easy way …
var divs1 = document.getElementsByTagName('a');    // Locate the "a" tag on the page
var z = 0;
for(var i =0; i < divs1.length; i++) //Loop through to find the browse icon
{
if(divs1[i].<a class="zem_slink" title="Internet Explorer" href="http://www.microsoft.com/windows/internet-explorer/" rel="homepage" target="_blank">innerHTML</a>.indexOf('addressbook.gif') > 0) // The name of the image is "addressbook.gif"
{
z++
if (z == 3)  // you have to manually count the total number of PeoplePicker on the page and target the one you want to disable
{
divs1[i].innerHTML = "</pre>
<img title="Browse" src="\&quot;/_layouts/images/addressbook.gif\&quot;" alt="Browse" />
<pre>"   // Append the innerHTML with display:none 
}
}
}
Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: