我有日历,有几个客户字段,并通过自定义表单进行输入。由于自定义表单默认为对人员选取器使用SharePoint:FormField;我使用以下命令包含了ClientPeoplePicker

<SharePoint:ClientPeoplePicker Required="true" ValidationEnabled="true" ID="peoplepciker"  runat="server" AutoFillEnabled="True" VisibleSuggestions="3"  Rows="1" AllowMultipleEntities="false"  CssClass="ms-long ms-spellcheck-true" Height="85px" />

有人可以建议我如何将该选民的输出“链接”/绑定(bind)到日历列表中的字段吗?

我仅使用SP_Designer2013和SharePoint客户端,无法以任何其他形状/形式访问后端/服务器。

任何帮助都将受到高度赞赏。

谢谢

最佳答案

我知道这对您来说可能为时已晚,但我也在寻找答案,并认为我会分享我的解决方案。

旧控制

在新表格中,我有一个要替换为ClientPeoplePicker的控件。

<SharePoint:FormField runat="server" id="ff2{$Pos}" ControlMode="New" FieldName="Person" __designer:bind="{ddwrt:DataBind('i',concat('ff2',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Person')}"/>

新控制

新的ClientPeoplePicker仅需要与我要替换的控件相同的id属性。
<SharePoint:ClientPeoplePicker runat="server" id="ff2{$Pos}" />

编辑

我找到了一个论坛,其中列出了控件的一些属性,并认为我会把它们发布给任何人,无论遇到什么问题。

http://social.msdn.microsoft.com/Forums/en-US/1bd323bf-a009-446b-aac5-e2b9ebde1a07/sharepoint-client-people-picker-allowing-multiple-entries
<SharePoint:ClientPeoplePicker
        Required="true"
        ValidationEnabled="true"
        ID="pplPickerSiteRequestor"
        UseLocalSuggestionCache="true"
        PrincipalAccountType="User"
        runat="server"
        VisibleSuggestions="3"
        Rows="1"
        AllowMultipleEntities="false"
        CssClass="ms-long ms-spellcheck-true user-block"
        ErrorMessage="*"
/>

<asp:CustomValidator
        ID="cvpplSiteRequestor"
        runat="server"
        ControlToValidate="pplPickerSiteRequestor"
        ForeColor="Red"
        ClientValidationFunction="CheckSiteRequestor"
        ErrorMessage="User is a required field"
        ValidationGroup="SiteAccessForm"
        Text="*">
</asp:CustomValidator>


function CheckSiteRequestor(sender, args) {
    args.IsValid = false;
    var userCount = $("span.ms-entity-resolved").length; //Returns the userNames Count

    if (userCount === 1) {
        args.IsValid = true;
    }
}

关于c# - CustomForm中的ClientPeoplePicker,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23061948/

10-13 06:01