function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ARUNBLIKESCLOUDARUNBLIKESCLOUD 

HTML inside Apex String

Folks,

I have an text area field on my Lead object and the field data is populated by a trigger.  I want to highlight some part of the string in bold. e.g:

Trigger.new[i].Description = '<b>'+'This is a test'+'</b>'; 

 

But the above statement does not  render the expected HTML text This is a test on the Description field. Rather the text is displayed with tags as such.

 

Any thoughts  ?? Your help is highly appreciated.

Message Edited by ARUNBLIKESCLOUD on 01-08-2010 07:44 AM
bob_buzzardbob_buzzard

If you are using this in an outputField in a VisualForce page, you can set the escape attribute to false to render the HTML.  However, if you are using this in a standard page I don't think there is any way to achieve this.  This kind of makes sense to me, as otherwise you could make the standard page render in rather strange ways, and potentially break it.

 

 

 

 

ARUNBLIKESCLOUDARUNBLIKESCLOUD

Bob,

Thanks for your response. Yes what I'm referring to is a standard page... I was just wondering if there would be a trickto hack this ... I hate to create an inline VF for this purpose alone.

 

 

Again, appreciate your response.