I am trying to render some HTML stored within a custom sObject's a richText field.

I am using an outputText field as follows:

<apex:outputText value="{!Information.Content__c}" escape="false"/>

The field contains the following:

<code> CoolCodeExample codeExample = new CoolCodeExample(); </code>

However, it is not being rendered as HTML.

When I inspected it in the browser, the <code> tag is being wrapped with double quotes.

Anyway I can have this properly rendered in HTML? I imagine it is something mundane I've overlooked. Any help is most appreciated.

  • Any reason why you go with output text .Go with outputfield instead Aug 6 '14 at 18:21

Per doc: https://help.salesforce.com/HTViewHelpDoc?id=fields_using_rich_text_area.htm&language=en_US

HTML code is not supported in the Salesforce HTML editor. HTML code is treated as text.

Using a Long Text Area field with

<apex:outputText value="{!Information.LongTextField__c}" escape="false"/> works.

  • Like I thought, some mundane detail I missed. Thank you very much. Aug 6 '14 at 18:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.