What you're are trying to do is actually pretty simple, and, thanks to Yii's jQuery encapsulation, you don't need to worry about jquery code. Here is the reference: http://www.yiiframework.com/wiki/24/creating-a-dependent-dropdown#hh0 Anyway, let me show you how to do it. But before I have a question for you: does this line of code: array( 'onChange' => 'javascript:description()' ), was your attempt to solve this problem? Or does it has another functionality unrelated to this topic? If it is part of your attempt to solve the problem, then just delete it. You won't need that. As I told you before, you don't need to worry about actual jquery code, it is well encapsulated in Yii. Other way, if it is unrelated to this topic, let it where it is, of course.
Now, about the ajax update. First all all, we need a div where the text box will be displayed; I'll use the description_id div. Then, the ajax request is specified inside the dropdownlist() as follows:
<?php echo $form->labelEx($model,'status'); ?>
<?php echo $form->dropDownList($model,'status',
array('0' =>'In active', '1'=> 'Active'),
array( 'onChange' => 'javascript:description()',
'ajax'=>array(
'type'=>'POST',
'url'=>CController::createUrl('YourController/actionWhichEchoesTheTextBox'),
'update'=>'#description_id',
)));
?>
<div id="description_id">
</div>
You may notice that in the 'url' attribute of the ajax declaration we specified the function which will be called when the ajax request triggers. In the 'update' attribute we specified the div where will be displayed the result of calling the function specified in the url attribute.
Finally, all that's left to do is declare the action actionWhichEchoesTheTextBox(). It can be declare in any controller, but if it is not in the current controller, then you have to declare it as static method in order to make it accessible here. So to avoid any problem, you should declare it in the current controller, and it would look something like this:
public function actionWhichEchoesTheTextBox()
{
if($_POST['ModelName']['status']===0)
echo CHtml::textField("ModelName", 'description'/*attribute name*/) ;
}
And that's it.