How to trigger a call to another function when a user fills the PeoplePicker

Aug 6, 2013 at 11:44 PM
Edited Aug 6, 2013 at 11:46 PM
Marc asked to move the question out here so here it is:

How would you go about running “$().SPServices.SPFindPeoplePicker” whenever a user finishes selecting a user?

Is it as simple as:

$(document).ready(function() {
var supervisor = $().SPFindPeoplePicker({
  peoplePickerDisplayName: "Requesting Supervisor"
}); 
supervisor.onblur="Checksupervisor()";
});
function Checksupervisor(){
  var supervisor = $().SPFindPeoplePicker({ peoplePickerDisplayName: "Requesting Supervisor"}); 
  var current = supervisor.currentValue;
  alert(current);     
}


Thanks in advance.
Coordinator
Aug 7, 2013 at 2:15 PM
It's not quite that simple because the name must be resolved. Can you explain a bit more about what you want to do with the value?

M.
Aug 7, 2013 at 5:25 PM

I want to user the user ID to call userprofileService.asmx and get other information

Coordinator
Aug 7, 2013 at 6:17 PM
Yes, but do you need to do that as the user adds people or groups (if the user is allowed to add multiple people the logic would be different) or can it happen when the item is submitted?

M.
Aug 11, 2013 at 6:54 PM
the business value could be the following scenario:
A user picks another user with the people picker
the event uses the selected user's ID to lookup Department location and other information about the selected user in userprofileService.asmx and show it right away by populating the innerHTML of some existing input boxes or a div. (or use knockout.js for binding the results)
My scenario is for picking just one user and not a group. And I am not sure what you refer to as ""item is submitted"
I am looking for some kind of AJAX like client side only UX.

I understand that the return type of .SPFindPeoplePicker() is complex and I will have to figure out the Jason when it comes back. but I need to understand where to write the code in order to trap the event o the end of the selection by the user.

Thanks in advance
Ofer