0

When I am creating a client side people picker,it is working fine when I am pasting the name or email ID on the textbox. But when i am writing in it, it won't work and no clues are coming for the users. Please help, the code is same as given everywhere.

1 Answer 1

0

Please try this..this is working code in my environment.

HTML:

<div class="form-group">
    <label id="Name">Employee Name<span class="error-msg">*</span>
    </label>
    <div id="txtName"></div>
</div>

JS:

<script type="text/javascript" src="<siteurl>/_layouts/15/sp.core.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/clienttemplates.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/clientforms.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/clientpeoplepicker.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/autofill.js"></script>
<script type="text/javascript" src="<siteurl>/_layouts/15/1033/sts_strings.js"></script>


<script type="text/javascript">
    $(document).ready(function() {
        initializePeoplePicker('txtName');
    });

    function initializePeoplePicker(peoplePickerElementId, Users) {
        if (typeof(Users) == 'undefined') Users = null;
        // 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'] = '280px';
        this.SPClientPeoplePicker_InitStandaloneControlWrapper(peoplePickerElementId, Users, schema);
    }
</script>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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