PART 2 : Working in MOSS using SPServices

In this article, we will see how to set and get People Picker value using SPFindPeoplePicker.

Get value from the people Picker:


<script>

var ppl = $().SPServices.SPFindPeoplePicker({
peoplePickerDisplayName: "User", //Display Name of People Picker Field
checkNames: true
});
alert(ppl.currentValue);

</script>

Set value to the People Picker:

To set static value in  the People Picker:


<script>

$(document).ready(function()
{
$().SPServices.SPFindPeoplePicker({
peoplePickerDisplayName: "User",
valueToSet: "kamal",
checkNames: true
});
});

</script>

To set logged in user name to the People Picker:


<script>

$(document).ready(function()
{
var user= $().SPServices.SPGetCurrentUser();
$().SPServices.SPFindPeoplePicker({
peoplePickerDisplayName: "User",
valueToSet: user,
checkNames: true
});
});

</script>

Advertisements

Leave a Comment

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