11

I have two lists: Projects and Tasks

In the Tasks list, I have created a lookup field titled ProjectID which targets ID filed from the Projects list. Also, I have set for this field to display an additional field ProjectID: Title. So, when I view the tasks I see the values for the particular project ID and Title.

However, on the display form for the Tasks I can only see the ProjectID field. I've modified the display form to hide the default display web part and created a custom one in order to be able to customize the fields presentation. Now I have two problems:

  1. ProjectID field is displaying the whole <a... /> tag instead of just the value for the ID (which should act as a link to the related project item)
  2. I can't find a way to display the ProjectID:Title field at all. I tried:
    <td width="400px" valign="top" class="ms-formbody">
        <xsl:value-of select="@ProjectID_x003a_Title" />
    </td>
    but the field is just blank.

Is there a way to be able to show lookup additional field in the display form?
Thanks.

3

[There was a not useful answer]

UPDATE: OK, I understand the problem now. In my case the field is present in the section (I've removed other fields for simplicity):

<DataFields>@MultiLookupTest_x003a_TestField,MultiLookupTest:TestField;</DataFields>

And then you can render it just in the same manner as others but you need to use a part of identifier:

<xsl:value-of select="@MultiLookupTest_x003a_TestField"/>

Unfortunately you'll get your projected value in the same form of tag. But here there's an advice:

I found another solution by selecting the cell and clicking "format as label".

Maybe it hepls you.

  • By default it works fine, but if you want to customize it then the problems appear. Open the DispForm.aspx in SharePoint Designer. Next, hide the default display web part. Next, go to Insert > SharePoint > Custom List Form and choose the same list and item display form type. The lookup field will get screwed up as described in the question and the lookup additional field will be missing and so on. – Boris Feb 28 '12 at 12:03
2

For parts 1 and 2 of your question: Not sure if this helps (I'm on SharePoint Online [2013]), but try using the SharePoint:CreatedModifiedInfo tag as suggested here to show properly hyperlinked version rather than all of the HTML tags. It worked for a custom field I did, though I had to remove an extra line of code from the original answer to avoid a duplicate. Here's what your code might look like:

<tr>
    <td valign="top" class="ms-formlabel">
        <nobr>Project Title</nobr>
    </td>
    <td valign="top" class="ms-formbody">
        <SharePoint:CreatedModifiedInfo ControlMode="Display" runat="server">
            <CustomTemplate>
                <SharePoint:FormField FieldName="ProjectID:Title" runat="server" ControlMode="Display" DisableInputFieldLabel="true" />
            </CustomTemplate>
        </SharePoint:CreatedModifiedInfo>
    </td>
</tr>

As a general other solution: If you don't need to display the ID at all anywhere and just want to show the title, how about trying to change the display through the column itself? If you go to the column in List Settings from the list's webpage, you can choose to display the title while still looking up through the ID by changing the only dropdown on the page to Project Title or whatever the field's name is (I left the ID field checked in the additional column list). When you go back to look at the field in a dropdown from another form like the new or edit forms, you will see the titles of the projects rather than the ID numbers.

0

You could use the 2010FilteredLookup addon from Codeplex. It is free and it allows you to have a lookupfield that is cross-site and returns multiple columns. You can even filter by list view or caml query.

But it will display more than one column - both the ID and Title and whatever you like as different columns in your list.

0

As for rendering field without escaping you should use following attribute:

<xsl:value-of disable-output-escaping="yes" select="@MultiLookupTest_x003a_TestField"/>

From MSDN:

disable-output-escaping

Default is "no". If the value is "yes", a text node generated by instantiating the element will be output without any escaping.

Consider disable-output-escaping="yes" an advanced feature, to be used only when the potential dangers are understood.

-1

You can set "readonly" property of your additional field to FALSE (by code or sharepoint manager, for example). Then this field will be presented in display form.

  • Do you mean to do that in the source list or somewhere in the list doing the lookup? And do you mean Sharepoint Designer when you say "sharepoint manager"? – bgmCoder Aug 3 '13 at 15:23

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.