SharePoint Display Templates – Display Enhanced Rich Text Field

In using some of the Display Templates, I noted that the Rich Text Content was being rendered as text … including all tags, etc.  I wanted to make sure my display templates rendered them as Rich Text Content.

Achieving this is fairly simple: Simply replace this

<div class="cbs-Line2 ms-noWrap" title="_#= $htmlEncode(line2.defaultValueRenderer(line4)) =#_" id="_#= line4Id =#_">
_#= line4 =#_
</div>

with this

<div title="_#= $htmlEncode(line4.defaultValueRenderer(line4)) =#_" id="_#= line4Id =#_">
_#= STSHtmlDecode(line4.value) =#_
</div>

(Replace the “_#= line4 =#_” with “_#= STSHtmlDecode(line4.value) =#_”). Also, to help ensure the content wraps correctly, please remove “class=”cbs-Line2 ms-noWrap” from the div in front (not all display templates may have this).

Advertisements

About Inge Rush

I love using SharePoint to create business solutions. I am not a SharePoint administrator or .net developer (although I dabble a bit). I just learn on-the-job as I solve problems.
This entry was posted in SharePoint 2013 and tagged , , . Bookmark the permalink.

One Response to SharePoint Display Templates – Display Enhanced Rich Text Field

  1. susan says:

    it gave me an error because it did not recognized Line4. If it is supposed to be a replacement of a piece with Line2, it should stay Line2. I am editing the template called 2lines.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s