0

I have a Object 'A' with field 'testField1' and it has html formatted text value..

Something like this:

testField1 = "<div class="text">sample text </div><div class = "boldthis"> bold this text</div>"

I have overriden the object detail page for object A with visualforce page and it has style attributes, so how do i apply these styles for the field "testField1" on the detail page?

I am trying to do with <apex:outputText value="{!A.testField1}"> but it is just printing raw html text?

3

1 Answer 1

1

Your question implies that the HTML markup is being shown onscreen.

If that's the case, you can use the escape attribute on the outputText tag and VisualForce will not convert the values from the text into the HTML entities when rendering the markup.

Documentation: <apex:outputText />

Example:

<apex:outputText value="{!A.testField1}" escape="false" />
1
  • Note that if you're planning on releasing this code as part of a managed package that the use of escape="false" will you mean you fail security review.
    – Matt Lacey
    Commented Mar 4, 2015 at 6:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .