重置fck编辑器值yii

时间:2012-04-28 09:30:10

标签: yii

我正在使用yii框架,我有fck编辑器的形式。如果我单击重置按钮,表单中的所有字段都将为空,但编辑器不会。这是fck编辑器的代码

$this->widget('application.extensions.fckeditor.FCKEditorWidget',array(
    "model"=>$model,                # Data-Model
    "attribute"=>'content',         # Attribute in the Data-Model
    "height"=>'400px',
    "width"=>'100%',

    "fckeditor"=>Yii::app()->basePath."/../fckeditor/fckeditor.php",
                                    # Path to fckeditor.php
    "fckBasePath"=>Yii::app()->baseUrl."/fckeditor/",
                                    # Relative Path to the Editor (from Web-Root)
    "config" => array("EditorAreaCSS"=>Yii::app()->baseUrl.'/css/index.css',),
                                    # Additional Parameters

我该怎么做?

1 个答案:

答案 0 :(得分:0)

AFAIK FCKEditor(以及任何其他类似的)基于简单的文本框(HTML元素textarea)。

如果您正在使用jQuery,我会考虑在重置表单后生成的视图中向onDocumentReady函数添加一段简单的代码(或者如果您没有重新加载页面,则直接添加到重置按钮的onClick代码重置后)。在这段代码中,我只是强制使用字段作为FCKEditor的基础来确保它是空的。

这样的事情:

$('#editor').val('');

从内存写入,但未经过测试。