Question

I have a document library with a custom DispForm.aspx page. In this library, I have a column with the option Append Changes to Text. The DispForm.aspx displays the information correctly by this code

<SharePoint:AppendOnlyHistory runat="server" FieldName="..." ControlMode="Display" ItemId="{@ID}"/>

Is there a way to have the DispForm.aspx page show the items, but not display the modified date and user who modified it?

Was it helpful?

Solution

The only way to do that would be to use javascript/jQuery. The code that you posted runs server side and you have no control over the output. You'll have to do some front-end manipulation after the page has been rendered. Hopefully, SharePoint gives you a good hook onto these elements, otherwise, it could be rather difficult.

Here's some jQuery to help you along:

// for the append-only comments, disable the click-to-view author and date

$("a[href*='_layouts/userdisp.aspx?ID=']").each(function(){ $(this).closest("span").replaceWith($(this).html()); }); $("a[href*='/Lists/MyListName/DispForm.aspx?ID=']").each(function(){ $(this).replaceWith($(this).html()); });

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top