SP People Picker Validation
pplpicker4.Controls.Clear();------> Used to clear the peoplepikker control (it means that clearing the user in people pikker)
validation message fire when user cliks in submit button
Change with PeoplePicker ID By Using Inspactelement......
<script type="text/javascript" language="javascript">
function CheckReportsTo(source, arguments) {
if (aspnetForm.ctl00_PlaceHolderMain_pplEHOD_downlevelTextBox.value == "")
arguments.IsValid = false;
else
arguments.IsValid = true;
}
</script>
ctl00_PlaceHolderMain_pplEHOD----> By clicking on people editor "inspect Elemt" their you can find the people picker Id copy it and replace
downlevelTextBox-------> It should be as it is copy paste...
<SharePoint:PeopleEditor ID="pplEHOD" runat="server" Height="21px" Width="200px"
ValidatorEnabled="true" MultiSelect="false" EnableBrowse="true" AllowEmpty="false" />
<asp:CustomValidator ID="CustomValidator8" ClientValidationFunction="CheckReportsTo"
runat="server" ControlToValidate="" Display="Dynamic" ValidationGroup="gr1" ErrorMessage="Please select My HOD"
ForeColor="Red" ValidateEmptyText="True"></asp:CustomValidator>
Comments