+ Start a Discussion
NaishadhNaishadh 

Visual Force HTML tag formatting problem

Hi, 

 

I want to display some text in bold style. I try to store it in differnt way but salesfoce do not parce that tag and display it as it is. Please help!

 

e.g.

 

Data in Database :-  

Visual Force development for creating <b>new</b> sites.  

 

page Output :- 

Visual Force development for creating <b>new</b> sites.  (It should display new as bold.)

 

please help! 

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Ron HessRon Hess

you may also want to read about using escape="false" on outputText

 

escape A Boolean value that specifies whether sensitive HTML and XML characters should be escaped in the HTML output generated by this component. If you do not specify escape="false", the character escape sequence displays as written. Be aware that setting this value to "false" may be a security risk because it allows arbitrary content, including JavaScript, that could be used in a malicious manner.

All Answers

Edwin VijayEdwin Vijay

Just print the value in the database and see what exactly is the value stored...

 

Use system.debug(Variablename)... Let me know how the value is stored, it will give an idea of what's going wrong where

 

Regards,

NaishadhNaishadh

It show the same string.

 

i.e. string in database

On an account record, if you click on the <b>New</b> button on the Contacts related list, what happens?

 

system.debug output

On an account record, if you click on the <b>New</b> button on the Contacts related list, what happens? 

Kirtesh_JainKirtesh_Jain

Hi , 

 

Can you give your VF code snippets for more clarifications abt error .

 

 

NaishadhNaishadh

Here is code.

 

 

public class htmlFormatController {
   
    List<Question__c> queList;
   
    public htmlFormatController() {
        /**
        *  data in question__C
        *  id   name description(Text Area Field)
        *  sid   id1     Demo String <b>script1</b> demo string.
        *  sid   id2     Demo String <b>script1</b> demo string.
        **/
        queList = new List<Question__c> ([select id,name, question_description__c from Question__c]);
    }   
   
    public List<Question__c> getQueList() {
        return queList;
    }   
   
}

 

 

 
<apex:page controller="htmlFormatController">
    <apex:repeat value="{!queList}" var="q">
        <apex:outputText value="{!q.id}"></apex:outputText><br/>
        <apex:outputText value="{!q.name}"></apex:outputText><br/>
        <apex:outputText value="{!q.question_description__c}"></apex:outputText><br/>
    </apex:repeat>
</apex:page>

 

 

Message Edited by Naishadh on 07-03-2009 05:20 AM
Kirtesh_JainKirtesh_Jain

Hi ,

 

you are using  <apex:outputtext /> so it will always display values as text.

so dont use it . Use your Html code in div just like  <div>{!q.name} </div> .

 

Kirtesh 

Ron HessRon Hess

you may also want to read about using escape="false" on outputText

 

escape A Boolean value that specifies whether sensitive HTML and XML characters should be escaped in the HTML output generated by this component. If you do not specify escape="false", the character escape sequence displays as written. Be aware that setting this value to "false" may be a security risk because it allows arbitrary content, including JavaScript, that could be used in a malicious manner.

This was selected as the best answer
GoForceGoGoForceGo

I have an html page (<html> .... </html>) that i get by using a webservice call.

 

how do i display this page in SFDC?

 

 

 

<apex:page controller="myController">
<apex:outputText value="{!displayResult}" escape="false" />
</apex:page>

 

This shows on screen as <html>...</html>

 

 

 

<apex:page controller="myController"> <apex:outputText value="{!displayResult}" escape="true" /> </apex:page>

 

 This shows on screen as  &lt;html&gt .....  &lt;/html&gt;