You need to sign in to do that
Don't have an account?
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"><strong>this should be bold</strong><br /><br><br /><br><div style="text-align: center; "><br> centered text<br /><br> <br /><br> <img alt="test image" src="<a href="http://sunshine.jpg" target="_blank">http://sunshine.jpg</a>" /></div></span>