1

I developped a js feature with a field people picker. I'd like to know how can i get the entered value Inside?

I've tried this without success because it's undefined.:

console.log(SPClientPeoplePicker.SPClientPeoplePickerDict["peopleEditor"].GetAllUserInfo());

Here is my field

And how i initialize it

function initializePeoplePicker(peoplePickerElementId) {

// Create a schema to store picker properties, and set the properties.
var schema = {};
schema['PrincipalAccountType'] = 'User,DL,SecGroup,SPGroup';
schema['SearchPrincipalSource'] = 15;
schema['ResolvePrincipalSource'] = 15;
schema['AllowMultipleValues'] = true;
schema['MaximumEntitySuggestions'] = 50;
schema['Width'] = '280px';

// Render and initialize the picker. 
// Pass the ID of the DOM element that contains the picker, an array of initial
// PickerEntity objects to set the picker value, and a schema that defines
// picker properties.
this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, null, schema);

}

1

Adding the people picker through JS tends to add "_TopSpan" to your container id. Try:

SPClientPeoplePicker.SPClientPeoplePickerDict["peopleEditor_TopSpan"].GetAllUserInfo()

or, if you're only interested in display names

SPClientPeoplePicker.SPClientPeoplePickerDict["peopleEditor_TopSpan"].GetResolvedUsersAsText()

If neither works, double check the people picker dictionary entries in case things went wonky in the generated name.

  • Hi, i tried this but it's undefined. i checked in developer Tools and i have something in: SPClientPeoplePicker.SPClientPeoplePickerDict["peopleEditor_TopSpan"] but nothing in getAllUserInfo() – user1898765 Nov 2 '16 at 16:37
  • the G should be capitalized (my mistake). edited the answer with correct casing – J.Matthews Nov 3 '16 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.