Showing posts with label people picker change event. Show all posts
Showing posts with label people picker change event. Show all posts

Monday, 26 February 2018

people picker change event



Call below function after initializing people picker control



var newUserEmailIdGlobalVariable="";

function PeoplePickerChangeEvent()
{
    this.SPClientPeoplePicker.SPClientPeoplePickerDict.newEmployeePicker_TopSpan.OnValueChangedClientScript=function (peoplePickerId, selectedUsersInfo)
{
if(selectedUsersInfo.length>0)
{
           console.log(selectedUsersInfo[0].EntityData.Email);
           newUserEmailIdGlobalVariable=selectedUsersInfo[0].EntityData.Email;
         }
         else
         {
          newUserEmailIdGlobalVariable="";
         }
         $('#txtNewUseremail').val(newUserEmailIdGlobalVariable);
       
    };

}



if does't work then call function in time out to initialize an event

like below


setTimeout(function(){  PeoplePickerChangeEvent() }, 3000);