Print this page

Unable to render Idea Body field in Visualforce using apex:outputField

Knowledge Article Number 000187765
Description - A Visualforce page uses standardController="Idea" and <apex:outputField value="{!Idea.Body}"
- The Body field is not visible when rendering the page.
- The browser returns a cross-site scripting (XSS) error in its console.
Resolution - Use <apex:outputText value="{!Idea.Body}" escape="false"/> instead.
- Without the escape="false" parameter, the HTML content of the Body Rich Text Field field will be escaped, such that the end-user sees only HTML code.
- outputField does not work because the Body field is rendered in an iFrame, by design.
- The iFrame is loaded by a Salesforce servlet and sets the frame in the normal, non-Visualforce domain, hence the XSS error when the iFrame content is loaded.
- Only the Body field is rendered in this manner;  any other custom RTF field can be rendered using outputField.




promote demote