简体   繁体   English

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

[英]how to auto save inputRichText content before validate

I have some trouble with inputRichText component (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"/>

and my CKConfig.js 和我的CKConfig.js

CKEDITOR.editorConfig = function( config )
{
   config.toolbar = 'MyToolbar';
   config.toolbar_MyToolbar = [['Bold','Italic', 'Underline'], ['Save']];
   config.contentsCss = '/css/CKStyle.css';
};
  1. This code return javascript error, it seem to be could not find out my toolbar config, my js path is right (I sure) 此代码返回javascript错误,似乎无法找到我的工具栏配置,我的js路径正确(我确定)

  2. Although using saveOnSubmit="true" first time I submit my form, content is not save, validator catch it content as empty (show validate msg), second times submit form it will pass, I think it validate before save content (instead of save before and validate after then) 尽管我第一次提交表单时使用saveOnSubmit =“ true”,但内容未保存,验证器将其内容捕获为空(显示验证消息),第二次提交表单将通过,我认为它在保存内容之前进行了验证(而不是保存)之前和之后进行验证)

Can anyone help me :( 谁能帮我 :(

sorry about this post. 对这个帖子感到抱歉。 I think I had miss something in config file, it work fine right now. 我想我在配置文件中错过了一些东西,现在可以正常工作。 my new config file : 我的新配置文件:

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']             
    ];

and xhtml 和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"/>

Note: I use CK v3.5, in config file cannot use group name, just [] not {[]} And in xhtml file, customConfigPath must be static url 注意:我使用CK v3.5,在配置文件中不能使用组名,仅[]不能{[]},并且在xhtml文件中,customConfigPath必须是静态url

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM