HTMLENDCODE and JSENCODE in Salesforce Visualforce

HTMLENDCODE and JSENCODE in Salesforce Visualforce

HTMLENDCODE() method encodes the text and merge field values for use in HTML by replacing the characters that are reserved in HTML.

JSENCODE() encodes the text and merge field values for use in JavaScript by inserting the escape characters.

Sample Code:

<apex:page standardController="Account">
    <apex:form >
        Account Name is : 
        <apex:outputText value="{!JSENCODE(HTMLENCODE(Account.Name))}"/>
    </apex:form>
</apex:page>

Leave a Reply