0

Here is My code.

<td>
    <SharePoint:ClientPeoplePicker VisibleSuggestions="5" Rows="1" ID="ppContractManager" 
    Enabled="true"   Required="true" runat="server" 
    ValidationEnabled="true" AllowMultipleEntities="true" Width="245px" />

    <asp:RequiredFieldValidator EnableClientScript="true" Display="None" 
    ValidationGroup="QC" ID="rfvppContractManager" ControlToValidate="ppContractManager" 
    runat="server" ValidateRequestMode="Enabled"   ValidateEmptyText="true"
    ErrorMessage="Enter Contract Manager" />
</td>    

enter image description here

Here i typed user name and i will click save button its working fine.In contract manager field i didn't enter anything and i will click save button its showing alert Enter Contract Manager.

But when i entered George or any user name and i removed this name & i will click save button its saving with empty value.

Once i entered name in people-picker its assuming its not empty so when i removed the name still its assuming the field is not Empty so its not showing alert message.Once i entered name after refreshing only it will work fine otherwise its saving with empty value.how to solve this please anyone suggest me.

0

You can use SharePoint:PeopleEditor control in place of SharePoint:ClientPeoplePicker.

<SharePoint:PeopleEditor ID="user" runat="server" SelectionSet="User" AllowEmpty="false" Enabled="false" MultiSelect="false" ValidatorEnabled="false"/>

to get value from PeopleEditor control.

  • using this SharePoint:ClientPeoplePicker only i did my full code. if i use people editor then i should change everything. Can you please tell me using clientpeople picker is not working ? – Elina Feb 17 '16 at 10:28
0

function plpckProjectSponsorFun() {
    var err = "";
    var pickval = document.getElementById('<%=ppContractManager.ClientID%>' + "_hiddenSpanData").value;
    if (pickval != "" && pickval != "&#160;" && pickval != "&nbsp;" && pickval != " ") {
        var v1 = Page_ClientValidate("QC");
        if (!v1) {
            return false;
        }
    }
}

Blockquote

  • Call this plpckProjectSponsorFun() on button click – Jayakumar Kulkarni Feb 17 '16 at 10:55
  • i tried this code but is not working i call this method in button click. – Elina Feb 17 '16 at 11:37

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.