Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

Updating Elrte Content By Ajax Call

$
0
0
Hi,

in my view i create a RTE by calling the widget:

 <?php
    $this->widget('application.extensions.elrte.elRTE', array(
        // required object CModel
        'model'=>$model,
        // reqired attribute of model
        'attribute'=>'body',
        // see available languages on elRTE documentation site
        'lang'=>'en',
        // editor height in pixels
        'height'=>200,
        // see available toolbars on elRTE documentation site
        'toolbar'=>'tiny',
        // use <span> with style or HTML tags
        'styleWithCss'=>true,
        // allow user to edit source
        'allowSource'=>true,
));
    ?>


this transform plain text area "body" to a nice working RTE:

		<?php echo $form->labelEx($model,'body'); ?>
		<?php echo $form->textArea($model,'body',array('rows'=>6, 'cols'=>50)); ?>
		<?php echo $form->error($model,'body'); ?>


Now I want to update RTE Content by ajax, so the javascript call (as documented) would be in my case

                                     $("#MyModel_body").elrte("val",data.html_body);


(while data.html_body is some json ajax response)

Now my problem: whatever I try, the selector $("#MyModel_body").elrte does not seem to work in my case. The stated javascript call has no effect but also does not throw any error in console

What am I doing wrong?

Thanks in advance for some tips...

Viewing all articles
Browse latest Browse all 18717

Trending Articles