SharePoint Custom List Form (Display) with Multi-v

2019-08-13 05:58发布

问题:

I have created a Custom List Form in SharePoint Designer for displaying items in a SharePoint List (A). One of the fields is a lookup of another List (B) for which there can be multiple values.

In the standard SharePoint DispForm.apsx, the value of the lookup field is displayed as links to the display view of each List B item that has been selected. They are on a new line like so:

Item 1 Item 2

When you create a Custom List Form, this instead produces a string of the text values (no links) from List B like so:

Item 1;Item 2

I have seen two solutions to getting the Custom List Form to display like the default DispForm.aspx but both have isses:

  1. Set the 'Item 1;Item 2' value on the SharePoint Designer page to display as List Form Field and change the view from 'Edit' to 'Display' (as provided by Quincy in this post: http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/f5ca14c2-925b-4f8d-b306-f7c3d1696be3/).

This works perfectly with the items linked to the correct items in List B. However, it shows the value from the first row of List A for every row instead of the value for the corresponding row (i.e. the first row of list A has items 1 and 2 selected from list B, the 5th row has items 3 and 9. when you display row 5 using this custom form it shows items 1 and 2)

  1. Use XSL to call a procedure which looks for ';' and splits the string into new lines. Then add a link around this. This works and shows the correct values for each list item we view. However, the link cannot be 'DispForm.aspx?ID=x' as the lookup doesn't store the ID. We can use 'DispForm.aspx?Title=x' but this just opens an blank version of the DispForm.aspx!

There are a few posts online asking the same thing with the 2 'solutions' above being the only real responses. There appears to be no answer though. Has anyone found a way of doing it?

回答1:

I got the same problem. Found your question on msdn forum. The advise

Click the lookup field, right click the arrow->Format Item as->List Form Field

and then

In code view, find SharePoint FormField tag, replace the controlmode="Edit" to controlmode="Display"

didn't help me too. But i found the more simple solution. Just open your list in SPD. Create new display form, add the required fields, then select your multiple value lookup field, right click, and then "Format item as" -> "Label".

That was a resolve in my case.



回答2:

I might be having a slightly different issue but I managed to fix by increasing the "item limit" in the default view.

Not ideal but luckily my list is not likely to reach 1000 items.

Worked for me.