Explore Courses Blog Tutorials Interview Questions
0 votes
in Salesforce by (11.9k points)

In Salesforce, if I'm binding a text field into a VisualForce page, whats a good way to convert the carriage returns in the text-field into HTML <br/> tags?

e.g. starting from something like this:

<apex:page standardController="Case">

  <apex:pageBlock title="Test">



  <apex:detail relatedList="false" />


... if the Description is long with lots of carriage returns, how do I HTML-ify it?

1 Answer

0 votes
by (32.1k points)
edited by

Try using this:

<apex:outputField value="{!case.Description}"/>

Using output fields will support formatting automagically.

Check out the Salesforce Training course and enroll today!

Browse Categories