SharePoint 2010:根据选择框选择触发的查询设置字段值

时间:2010-03-14 20:03:11

标签: sharepoint forms infopath field sharepoint-2010

如何将表单字段链接到选择框选择,以便字段的值由选择框选择的ID引用的信息设置?我在自定义列表表单中有一个选项框,该表单绑定到“客户端”列表,其中包含客户端名称,ID,引用号,地址等。选项框显示客户端名称并将所选值设置为ID。然后,我想通过所选ID查询客户端列表,以使用客户端名称,客户端地址,客户端电话等填充表单字段。有没有办法在不使用自定义代码的情况下执行此操作?我正在使用SharePoint 2010,SharePoint Designer 2010和InfoPath作为表单。

1 个答案:

答案 0 :(得分:0)

我觉得这不受支持,但我能够通过在自定义列表模板的schema.xml中创建以下字段来实现此目的:

<Field ID="{AB09A2D6-EBD4-4511-AE91-A8C54DC8442F}"
    Type="Lookup"
    Name="CustomItemIdLookup"
    DisplayName="Client"
    List="$Resources:core,lists_Folder;/Client"
    ShowField="Title"
    Hidden="FALSE"
    Required="TRUE"
    StaticName="CustomItemIdLookup">
</Field>
<Field ID="{E558933C-A03B-4932-85C9-6A786396AA78}"
    Type="Lookup"
    Name="CustomClientNameLookup"
    DisplayName="Client Name"
    List="$Resources:core,lists_Folder;/Client"
    ShowField="CustomClientName"
    Hidden="FALSE"
    JoinColName="tp_ID"
    JoinRowOrdinal="0"
    JoinType="INNER"
    FieldRef="CustomItemIdLookup"
    ReadOnly="FALSE"
    ShowInNewForm="FALSE"
    ShowInEditForm="FALSE">
</Field>
<Field ID="{5292CB52-80C7-4AFA-BA3E-93FDF22B37E3}"
    Type="Lookup"
    Name="CustomClientAddressLookup"
    DisplayName="Client Address"
    List="$Resources:core,lists_Folder;/Client"
    ShowField="CustomClientAddress"
    Hidden="FALSE"
    JoinColName="tp_ID"
    JoinRowOrdinal="0"
    JoinType="INNER"
    FieldRef="CustomItemIdLookup"
    ReadOnly="FALSE"
    ShowInNewForm="FALSE"
    ShowInEditForm="FALSE">
</Field>
<Field ID="{B3E22803-9A4B-4E7E-B05F-82221C182735}"
    Type="Lookup"
    Name="CustomClientPhoneLookup"
    DisplayName="Client Phone"
    List="$Resources:core,lists_Folder;/Client"
    ShowField="CustomClientPhone"
    Hidden="FALSE"
    JoinColName="tp_ID"
    JoinRowOrdinal="0"
    JoinType="INNER"
    FieldRef="CustomItemIdLookup"
    ReadOnly="FALSE"
    ShowInNewForm="FALSE"
    ShowInEditForm="FALSE">
</Field>

注意,客户端名称,客户端地址,客户端电话将无法编辑,富文本/多行字段不起作用。