Yii 1.1: xheditor

xhEditor is a simple,small,fast WYSWYG(What You See What You Get) XHTML editor based by jQuery(tinyMCE)

xhEditor is a simple,small,fast WYSWYG(What You See What You Get) XHTML editor based by jQuery. that is webbased and compatible with Internet Explorer 6.0-8.0,Firefox 3.0,Opera 9.6,Chrome 1.0,Safari 3.22 .

xhEditor是一个基于jQuery开发的简单迷你并且高效的可视化XHTML编辑器,基于网络访问并且兼容IE 6.0-8.0,Firefox 3.0,Opera 9.6,Chrome 1.0,Safari 3.22。




  • Yii 1.0 or above


  • Extract the release file under protected/extensions


See the following code example:

$this->widget('application.extensions.xheditor.JXHEditor', array(
    'model' => $model,
    'attribute' => 'content',
    'htmlOptions'=>array('cols'=>80,'rows'=>20,'style'=>'width: 100%; height: 500px;'),

Change Log

January 7, 2010

  • Initial release.

Total 13 comments

#11933 report it
sjg at 2013/02/13 01:23pm
Functional Testing

Because xhEditor creates an iframe out of the input field, there's a trick to accessing the field via Selenium: you need to switch the frame.

$this->selectFrame("//*[@id='xhEdt0_iframe']"); // switch to the iframe $this->type("//body","This text shows up in the xhEdit WYSIWYG!");
#6600 report it
Tomas L at 2012/01/20 04:37am
Error fix

Regarding C.attr("class") is undefined error -

Actually there's javascript error which stops script from working. Javascript does not find textarea (field to be edited) that has 'class' attribute 'xheditor'. So you should add 'class' attribute manually.

What you need to do is -

In file protected\extensions\xheditor\JXHEditor.php Add line (in line 43):


right before :

if($this->hasModel()) echo CHtml::activeTextArea($this->model,$this->attribute,$this->htmlOptions); else echo CHtml::textArea($name,$this->value,$this->htmlOptions);

#5232 report it
kusanagi at 2011/09/25 07:07am

hi i got error C.attr("class") is undefined

#2961 report it
choiceerp at 2011/03/02 07:40pm
There is a bug when using this extension with theme

The path is wrong when using this extension with theme, result: www.mysite.com/undefinedxheditor_skin/o2007blue/ui.css www.mysite.com/undefinedxheditor_skin/o2007blue/iframe.css

result the 2 css file not found: ui.css and iframe.css

#239 report it
swafsarl at 2010/07/29 01:26pm
Disble unload event!!

To disable the annoying unload event, just open the file "xheditor/xheditor-en.js" and comment the following line (197)

jpWin.unload(_this.getSource).bind('beforeunload', _this.getSource);

Dont forget to remove the already published assets files and enpty browser cache before testing

#460 report it
persia at 2010/05/25 10:36am
uplaod a file

I fixed the error "model attribute undefined !!," but now i want to upload a file using the upImgUrl attribute:

'upImgUrl' => 'create' // create is the action name in the controller

In my controller i have this:

$model=new Item; if(isset($_POST'Item')) { $model->attributes=$_POST'Item'; $model->image=CUploadedFile::getInstance($model,'image'); if($model->save()) { $model->image->saveAs('./myfiles'); } } $this->render('create', array('model'=>$model));

but i have this following error: create upload interface error

Do you have an idea how i can solve this or an example showing how to upload a file using the xheditor in Yii?


#469 report it
choiceerp at 2010/05/24 04:24am
JXHEditor must specify "model" and "attribute" or "name" property values.

I copy paste the sample and i get this error !!! If you don't give a documentation, at list give an working exemple to permit to try this control.

#488 report it
persia at 2010/05/16 09:48pm
model attribute undefined !!


First error i get is model attribute undefined !!,

There's a good example which explain how to use JXHEditor? and saving the content in the database, etc.


#690 report it
jerry2801 at 2010/03/17 09:25pm
re Rosimildo

When I submit the form, it warns that we're leaving the page.... how to disable that.

i think it is jquery 1.4.1 take the message, you can download xheditor1.0beta(for jquery1.4.1) to try

#714 report it
Rosimildo at 2010/03/13 09:44am
How to disable the dialog when saving ?

When I submit the form, it warns that we're leaving the page.... how to disable that.

#739 report it
mzoli at 2010/03/08 04:34pm

I had to edit the class file: class JXHEditor extends widget to class JXHEditor extends CWidget

Anyway...nice work;) 5 stars.

#773 report it
Luciano at 2010/03/01 07:53am
Now we're talking

Now it's a 5 stars extension...

#930 report it
Luciano at 2010/01/27 04:42pm
Great but undocumented

It works great...thanks for this! :D Had to see the source file to get how to use it:

* JXHEditor class file.
* @author jerry2801 <jerry2801@gmail.com>
* A typical usage of JXHEditor is as follows:
* <pre>
* this->widget('application.extensions.xheditor.JXHEditor', array(
*     'model' => $model,
*     'attribute' => 'intro',
*     'options' => array(
*         'width' => '100%',
*         'height' => 400,
*     ),
* ));
* </pre>

Now using it... Please give some basic documentation...

Leave a comment

Please to leave your comment.

Create extension