People Picker Check User Entry and Resolve

Leave a Comment
Hi All,

In following post we will see a simple Code Snippet , which is useful in a scenario like if we are using SharePoint People Picker in Our Visual Webpart. In a browser after entering some text in People Picker , Generally  most of the users will click "Ctrl + K" to resolve the entered Text.

below Code snippet, will do that automatically.

People picker in .ascx :

<SharePoint:PeopleEditor ID="PEUser" onfocusOut="return PeoplePickerFocusValidation()" ValidatorEnabled="true" EnableViewState="true" runat="server" Rows="1" MultiSelect="true" AllowEmpty="false" SelectionSet="User" CssClass="PeoplePicker" EnableBrowse="true" />

My function :

function PeoplePickerFocusValidation() { 
var pickval = document.getElementById('<%=PEUser.ClientID%>' + "_hiddenSpanData").value;
pickval = pickval.replace(/ /gi, '');
if ((pickval != null) && (pickval != '') && (pickval != '')) {
document.getElementById('<%=PEUser.ClientID%>' + "_checkNames").click();
} 
}

On Changing the focus from People Picker we are calling a function "PeoplePickerFocusValidation".

Thanks,

Related Post

0 comments:

Post a Comment