如何在验证之前自动保存inputRichText内容

时间:2012-10-04 03:39:21

标签: ckeditor validation icefaces fckeditor icefaces-3

我对inputRichText组件(icefaces 3)有一些麻烦

<ice:inputRichText  id="content" value="#{CchcDmFeedbackController.objFeedback.fbContent}"
       required="true" requiredMessage="This is required" skin="office2003" 
       styleClass="editor"  saveOnSubmit="true" toolbar="MyToolbar"
       customConfigPath="#{resource['js:CKConfig.js']}"/>   
<ice:message for="content"/>

和我的CKConfig.js

CKEDITOR.editorConfig = function( config )
{
   config.toolbar = 'MyToolbar';
   config.toolbar_MyToolbar = [['Bold','Italic', 'Underline'], ['Save']];
   config.contentsCss = '/css/CKStyle.css';
};
  1. 此代码返回javascript错误,似乎无法找到我的工具栏配置,我的js路径是对的(我确定)

  2. 虽然我第一次提交表单时使用saveOnSubmit =“true”,但内容未保存,验证器将其内容保存为空(show validate msg),第二次提交表单将通过,我认为之前验证保存内容(而不是之前保存并在之后验证)

  3. 任何人都可以帮助我:(

1 个答案:

答案 0 :(得分:0)

抱歉这篇文章。我想我在配置文件中遗漏了一些东西,它现在正常工作。 我的新配置文件:

CKEDITOR.config.resize_maxWidth = "100%";
CKEDITOR.config.tabSpaces = 5;
CKEDITOR.config.defaultLanguage = 'vi';
CKEDITOR.config.toolbar = 'MyToolbar';
CKEDITOR.config.toolbar_MyToolbar =
    [
        [ 'Source','-','Save','Preview'],
        [ 'Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo' ] ,
        [ 'Find','Replace','SelectAll' ] ,
        '/',                    
        [ 'Bold','Italic','Underline','-','Strike','Subscript','Superscript','-','RemoveFormat' ] ,
        [ 'NumberedList','BulletedList','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ] ,
        [ 'TextColor','BGColor' ],
        '/',        
        [ 'Format','Font','FontSize' ],
        ['Maximize', 'ShowBlocks' ] ,
        [ 'Link','Unlink'] , 
        [ 'Image','Smiley']             
    ];

和xhtml

<ice:inputRichText  id="noidung" value="#{CchcDmFeedbackController.objFeedback.fbNoidung}" required="true" requiredMessage="Vui lòng nhập nội dung" skin="kama" styleClass="editor" saveOnSubmit="true" toolbar="MyToolbar"  customConfigPath="/resources/js/CKConfig.js"/> 
<h:message for="noidung"/>

注意: 我使用CK v3.5,在配置文件中不能使用组名,只是[]而不是{[]} 在xhtml文件中,customConfigPath必须是静态URL