Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I've built my people picker using the normal method for client side:

// Render and initialize the client-side People Picker
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'] = false;
schema['MaximumEntitySuggestions'] = 50;
schema['Width'] = '300px';
schema['Required'] = true;

// 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);
 }

and I've set the required to true but no validation is taking place? Does this only work for server side PP controls?

S

share|improve this question
    
Probably, because that validation takes place on server side if I am not wrong –  Robert Lindgren Jan 13 at 16:38
1  
yeah thought as much currently working out a way to do this client side. –  Stephen Jan 13 at 16:40
add comment

1 Answer

You can use javascript to validate the people picker by get all the users in that:

var peoplePickerElementId = "peoplePickerID"; 

var peoplePickerElement = SPClientPeoplePicker.SPClientPeoplePickerDict.peoplePickerID_TopSpan;
var users = peoplePickerElement.GetAllUserInfo();
if(users.length > 0)
{
    //continue;
}
else
{
    alert("Required");
} 
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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