function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
frogfrog 

rendering Rich Text in outputField and outputText

 Hi I try to use documentation and google to sort my problems but this time I'm too puzzled.

 

I have visual page that creates feedItems with rich text and one that is supposed to display them.

I know I should be able to display rich text using outputField or outputText with escape='false'.

 

Should.... When I use outputField the html tags are escaped! When I use outputText rendering works for everything except bold font that is displayed as normal text.

 

Can someone give me an explanation why things do not work for me and perhaps some suggestion how to fix them.

 

cheers

 

my test feedItem object

FeedItem:{
     Body=<strong>this should be bold</strong><br />
    <br />
    <div style="text-align: center; ">
      centered text<br />
   <br />
    <img alt="test image" src="http://sunshine.jpg" /></div>,
   

  Id=0D5f0000000ZGGuCAO
}

 

Attempt with outputText

 

<p class="content">
         <apex:outputText escape="false" value="{!wrapper.fContent.body}"/>
</p>

and resulting HTML code

 

<p class="content"><strong>this should be bold </strong><br>
<br>
</p>
<div style="text-align: center; ">
centered text<br>
<br>
<img alt="test image" src="http://sunshine.jpg">
</div>

 

Attempt with OutputField

 

<p class="content">
<apex:outputField value="{!wrapper.fContent.body}"/>
</p>

and resulting HTML code

<span id="j_id0:feedForm:j_id98:0:j_id115">&lt;strong&gt;this should be bold&lt;/strong&gt;&lt;br /&gt;<br>&lt;br /&gt;<br>&lt;div style="text-align: center; "&gt;<br> centered text&lt;br /&gt;<br> &lt;br /&gt;<br> &lt;img alt="test image" src="<a href="http://sunshine.jpg" target="_blank">http://sunshine.jpg</a>" /&gt;&lt;/div&gt;</span>