TextArea set default text

i use follow code to creatte a TextArea.

<?php echo CHtml::activeTextArea($form,'detail',array('value'=>"12"));?>

but how can i set the default value to the textarea

I want this result:


You have to set

$form->detail = 12;

You should do that in your model class ($form):

public $detail='This is the default text';

EDIT: Oh, Spyros was faster :)


need some help, i have a code like this

<?php echo $form->comment='tesstt'; ?>

<?php echo $form->labelEx($model,'comment'); ?>

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

<?php echo $form->error($model,'comment'); ?>

but there is an error

Property "CActiveForm.comment" is not defined.

is there something wrong with the code?

i sugest that code not need to write…

yes. originally is just what you mean…

But like the topic says set default text… that’s what i want :(


<?php echo $form->labelEx($model,'comment'); ?>


$model->comment = "testcomment";

echo $form->textArea($model,'comment',array('rows'=>6, 'cols'=>50)); ?>

<?php echo $form->error($model,'comment'); ?>

problem solved.