VisualForce: convert carriage returns to html line-breaks in a long text field

Posted by codeulike on Stack Overflow See other posts from Stack Overflow or by codeulike
Published on 2010-03-26T18:20:36Z Indexed on 2010/03/26 18:23 UTC
Read the original article Hit count: 869

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">
      <p>{!case.Description}</p>
  </apex:pageBlock>                   
  <apex:detail relatedList="false" />
</apex:page> 

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

(I guess this is a fairly easy question, and I'm sure I could google it, but to get the Salesforce community going on here I figure we need a few easy questions.)

© Stack Overflow or respective owner

Related posts about salesforce

Related posts about visualforce