Custom Form Does Not Display “Created By” value
-
06-12-2019 - |
문제
I'm creating a custom form in SharePoint designer and I'd like to display the value of the "Created By" field in a section of the form. I've done this successfully with other columns in the form.
For example, in SPDesigner, I selected the "Title" field and changed the "Format As" value to "Text". As a result, SPDesigner updated the HTML code to look like this: <xsl:value-of select="@Title" />
. The result is that the Title field value is displayed (not editable) in the form.
However, when I try to use the code <xsl:value-of select="@Created_x0020_By" />
to display the name of the person who created the list item - nothing displays in this location on the form.
Can anyone tell me how I can display the list item creator's name in my custom form?
해결책
This is the way it works for me:
<tr>
<td valign="top" class="ms-formlabel"><nobr>Created by</nobr></td>
<td valign="top" class="ms-formbody">
<SharePoint:CreatedModifiedInfo ControlMode="Display" runat="server">
<CustomTemplate>
<SharePoint:FormField FieldName="Author" runat="server" ControlMode="Display" DisableInputFieldLabel="true" /><br/>
<SharePoint:FieldValue FieldName="Modified" runat="server" ControlMode="Display" DisableInputFieldLabel="true"/>
</CustomTemplate>
</SharePoint:CreatedModifiedInfo>
</td>
</tr>
다른 팁
Try <xsl:value-of select="@Author" />
instead.
I faced similar kind of issue in development. My requirement was to make custom edit form and disable a few fields if the logged in user and the created by of the account was same. I tried retrieving the @Author value using but it always displayed null.
So found a very good solution on it. In designer find the line
Change the ListItem To List. With this you will get all the fields of the list including @Author , @Editor ,@Created and @Modified.
The only issue is you will all the items , so u will have to filter the item based on the id that we get in the querystring