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
XhitmanXhitman 

LongTextArea - SFDC cleansing and trimming

 

Hi we currently have a long text area field where users could put some comments and other details about a specific record. There are cases where user would need to put in javascript code, urls, iframe code into the comments. The problem is that content and formatting is lost whenever a comment is posted. 

This following example: 

<HEAD> <TITLE>Cool JavaScripts</TITLE> 
<SCRIPT language="JavaScript"> <!-- hide from old browsers 
alert('Welcome to my Web Site!'); 
//--> </SCRIPT> 
</HEAD>

Would turn into this: 

<SCRIPT language="JavaScript"> <!-- hide from old browsers alert('Welcome to my Web Site!'); //--> </SCRIPT>

Any suggestions that we can do? 

Should we be using the apex:inputTextArea or the apex:inputField? 

Is there a way to disable the auto-formatting?

 

We don't want to execute the script upon load but we want to preserve the formatting. Would having a rich text area help in this case? We are already using <apex:outputText escape="false" value="{!c.cmMsg.Message__c}" /> so that the content would display.