+ Start a Discussion

Potential bug with loading rich edit boxes via Ajax callback

I have a small page with a dynamic ajax outputPanel that gets rerendered on certain user action and it all works good until the newly loaded pageBlock contains rich edit field (rendered with apex : inputField). Then, I get this javascript error and the entire viewport gets blanked. The initial page load does not contain rich edit field (in case it makes a difference, like it did with calendar popups)




Object doesn't support this property or method

3_3_0.GAorg.ajax4jsf.javascript.AjaxScript, line 173 character 590


By the looks of call stack it appears as if the Ajax caller failed to parse the response from SF and tried to raise an error and then ran into a missing property/method. The error location is pointing to a piece of code containing "finally{window.document.open=oldDocOpen;}" if that makes any difference as well.


OK, I debugged the offending JS code and I managed to reach the actual error.


"Rerender is not currently supported with rich text editing enabled"


Is this what it is, no support for richedit in Ajax? What is the timetable for this feature (please dont tell me to put it up  for vox-populis approval on idea exchange, it should be your responsability not to release half baked solutions) 


This is the sample code of richtext Editor. When you use rerender attribute with command button it gives an error like 'Rerender is not currently supported with rich text editing enabled' , so you can't use rerender with rich text editor. It will work fine if use the code without rerender. Find below a sample code :


<apex:page controller="cls_richbox">
            <apex:form >
            <apex:outputPanel id="richrend">
                 <apex:pageBlock title="RichEditBox">
                      <apex:pageBlockSection title="RichTextEditor" >
                      <apex:pageBlockSectionItem >
                      <apex:inputTextarea value="{!inputValue}" id="theTextarea" richText="true" />
                  <apex:pageBlockButtons >
                           <apex:commandButton value="Save" action="{!doSave}" reRender="richrend"/>
public class cls_richbox
    public string inputValue{get;set;}   
        public cls_richbox(){}
    public void doSave()   
           system.debug('$$$$$$$$' + inputValue);     
           Employee__c emp = new Employee__c();     
           emp.name = 'testdata101';     
           emp.testrich__c = inputValue;     
           insert emp;   


Hope this helps.


For Example


<apex:page standardController="Question_Set__c">
<script src="/apexpages/fckeditor/fckeditor.js" type="text/javascript"></script>

function isTxtCheckSend() {
var a = FCKeditorAPI.GetInstance('j_id0:AllList:frmQ:theTextarea').EditorWindow.parent.FCK.GetHTML() ;

<apex:outputpanel  rendered="Your CONDITION">
<apex:inputTextarea value="{!CurQA.Rich_Text_Question__c}" id="theTextarea" required="true" tabIndex="2"/>
<script type="text/javascript">
var editor = new FCKeditor('j_id0:AllList:frmQ:theTextarea', null, 425);
editor.BasePath = '/apexpages/fckeditor/';
editor.Config['CustomConfigurationsPath'] = '/apexpages/richtext.config.js';
editor.ToolbarSet = 'SalesforceBasic';
editor.Config['SkinPath'] = editor.BasePath + 'editor/skins/sfdc/';
editor.Config['DefaultLanguage'] = 'en-us';
editor.Config['EditorAreaStyles'] = ['/sCSS/23.0/sprites/1323209069000/Theme3/default/gc/HtmlDetailElem.css'];
editor.Config['ImageUpload'] = true;
editor.Config['SitesPath'] = '';

<apex:commandButton id="QASave" onclick="isTxtCheckSend()"/>