重置fck编辑器值yii
问题描述:
我正在使用yii框架,并且我在表格中有fck编辑器。如果我点击重置按钮,表格中的所有字段都会变空,但编辑器不会。这是fck编辑器的代码重置fck编辑器值yii
$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
我该怎么做?
答
AFAIK FCKEditor(以及其他类似的)基于简单的文本框(HTML元素textarea)。
如果您使用jQuery,我会考虑在窗体重置后生成的视图中添加一段简单的代码到onDocumentReady函数中(或者直接重置按钮的onClick代码,如果您没有重新加载重置后的页面)。在这段代码中,我只是强制用作FCKEditor基础的字段,以确保它是空的。
事情是这样的:
$('#editor').val('');
从内存中写的,但没有测试。
似乎它不是yii的问题,但fckeditor,也许设置存储在饼干? – llamerr 2012-04-28 16:02:11