Thursday, October 22, 2015

SPClientPeoplePicker is undefined

function SetAndResolvePeoplePicker(fieldName, userAccountName) {

var controlName = fieldName;

var peoplePickerDiv = $("[id$='ClientPeoplePicker'][title='" + controlName + "']");

var peoplePickerEditor = peoplePickerDiv.find("[title='" + controlName + "']");

var spPeoplePicker = SPClientPeoplePicker.SPClientPeoplePickerDict[peoplePickerDiv[0].id];

peoplePickerEditor.val(userAccountName);

spPeoplePicker.AddUnresolvedUserFromEditor(true);

//disable the field

spPeoplePicker.SetEnabledState(false);

//hide the delete/remove use image from the people picker

$('.sp-peoplepicker-delImage').css('display','none');

}

No comments:

Post a Comment