You need to sign in to do that
Don't have an account?
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"/>
</apex:form>
</apex:page>
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.
Thanks.
Hi Neeraj,
Try the previous version and test with "fckeditor" if it works.
Regards,
Ashish
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.
-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.
<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.