You need to sign in to do that
Don't have an account?
tinman44
Then in the controller I want to display it in the VF page:
Render HTML stored in field?
Hello all-
I am trying to display HTML stored in a field on a Visualforce page. But not sure it is possible. For example:
I have a custom object "HTML_Object__c" with a field called "". I want to call a custom component in a page that calls a custom controller that queries SFDC for this fields data:
Code:
public HTML_Object__c getHTMLText() { HTML_Object__c HTMLText= [select from HTML_Object__c Where SOME CONDITION IS TRUE]; return HTMLText; }
Then in the controller I want to display it in the VF page:
Code:
{!HTMLText.HTML_output__c}
The problem is it displays the HTML as HTML. So if I had "<strong>Test</strong>" stored in the field it would display exactly that and not "test".
Any one know if I can do this?? Thanks in advance
Jeremy Kraybill
Austin, TX
Thanks for the quick response!
I tried that and it is still rendering it as "<strong>test</strong>".
Am I just seeing a bug? Have you gotten that to work?
I tried one more time and saw what I was doing wrong...I was putting it between the tags not in the value.
Once I moved it to this way it worked like a charm.
Thanks!
shows
<strong>Text</strong>
Text
You should be aware that this may allow non HTML to be rendered as well, including javascript, see the docs for more on this important detail.
How to get the same for selectoption label
controller returns selectOption label as html
Thanks Jeremy!