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

Reading rich text from CKEditor

I have created a custom object (Template_Information__c)  with rich text custom field (RichTextArea__c). I am reading the rich text in my vf page as follows:


<apex:page id="pageid" controller="SelectTemplateController">


     <!-- Add the javascript file to intialize the CkEditor -->
     <apex:includescript value="{!URLFOR($Resource.CkEditor, 'ckeditor/ckeditor.js')}" />

     <apex:form id="formid">

    <apex:commandButton action="{!redirectToTemplate}" value="Go to template" reRender="rich"/>

    <apex:inputTextarea id="inputid" value="{!templateInfo.RichTextArea__c}" styleClass="ckeditor" richText="false"/>




At the controller side:


public with sharing class SelectTemplateController {

public Template_Information__c templateInfo {get; set;}

public SelectTemplateController() {
templateInfo = new Template_Information__c();


public Pagereference redirectToTemplate() {

insert templateInfo;
System.debug('OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO templateInfo.Id : ' + templateInfo.Id);



The issue is, the object is saved but when I do a query to fetch the RichTextArea__c it returns null. 


From what I have seen, this issue is due to the ckeditor. If I remove the styleClass="ckeditor" from the inputtextarea tag, the entered content is saved properly. 


Has anyone worked with the ckeditor before? 

I do not understand whay the content from the editor does not get saved in the rich text custom field.




Hi Neeraj, 


Try the previous version and test with "fckeditor" if it works. 




hi Neeraj,

Am also usinf CKEditor and i uploaded the zip file in sattic resources and created a vf page but am getting error like "Uncaught ReferenceError: CKEDITOR is not defined". Could you please help me how to solve this issue.

Thnak you in advance.

Hi Aditya,

Your problem is probably due to the fact that you are incorrectly referencing the ckeditor in your includeScript on your vf page. 
Make sure you are correclty referencing the ckeditor.js.
Also I later on changed the method I mentioned above and started using the contentEditable property of a html div with the ckeditor.
Could you please share if you have any code snippet to show ckeditor in a visualforce page. I a not getting how and where I am doing mistake. I downloaded the ckeditor and with thw same name I uploaded all the content and referencing same. But still no luck. I know i am doing a small mistake but not getting where exactly am doing mistake.Please help me in this. - aditya. sent from my samsung mobile
This is the way I am including the ckeditor in my vf page

<apex:includeScript value="{!URLFOR($Resource.ckeditor, '/ckeditor/ckeditor.js')}"/>
 <apex:includeScript value="{!URLFOR($Resource.ckeditor, '/ckeditor/adapters/jquery.js')}"/>

But then again, it all depends on the folder structure of your individual static resource.

Hi, I am trying in the same way but not working. My folder structure is like Static resource name is "ckeditor" and the folder that i uplaoder is "" which contains all files related to ckeditor. Please find the attached image for the format. But still on my vf page am not getting ckeditor. Please help me as it is very important for me to get this. - Aditya.