In my web application, I want to set a default value to CHtml::textArea. In my view,
<?php echo CHtml::textArea('answer' . $no, '', array('rows' => 6, 'cols' => 50, 'class' => "form-control",'value'=>$exam->answer)); ?>
But, this is not working. How can I do this?
You can set it directly as the second parameter:
CHtml::textArea('answer' . $no, $exam->answer, array(
'rows' => 6, 'cols' => 50, 'class' => "form-control")
);
See CHtml::textArea for more details.