How do you link a form field to a choicebox selection so that the field's value is set by the information referenced by the ID of the choicebox selection? I have a choicebox in a custom list form which is bound to a "Client" list which contains client names, IDs, reference numbers, addresses, etc. The choicebox displays the client name and has the selected value set to ID. I would then like to query the Client list by the selected ID to populate form fields with Client Name, Client Address, Client Phone, etc. Is there a way to do this without using custom code? I am using SharePoint 2010, SharePoint Designer 2010 and InfoPath for the forms.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
I have a feeling this is not supported, but I was able to get this working by creating fields as follows in the schema.xml of my custom list template:
<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>
Note, Client Name, Client Address, Client Phone will not be editable and rich text/multiline fields do not work.