CHtml vs CForm for a CActiveForm

I’d like to create a CActiveForm using the CForm system.

What I don’t understand is why building the form using CHtml in the view file like this works:

<div class="form">

<?php $form = $this->beginWidget('CActiveForm', array(



)); ?>

<?php echo $form->errorSummary($model); ?>

<div class="row">

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

    <?php echo $form->textArea($model,'content'); ?>

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


<?php echo CHtml::submitButton('Answer'); ?>

<?php $this->endWidget(); ?>


While the following CForm combined with the view code below does not work:


return array(

    'title'=>yii::t('main','Please enter your answer'),

    'activeForm' => array(

        'class' => 'CActiveForm',

        'enableAjaxValidation' => true,

        'id' => 'answer-form',



















view file:

<div class="form">

    <?php echo $form; ?>


the content element is set to be required in the rules section of the model.

I swear I had it working yesterday, but can’t seem to figure it out today and it’s really frustrating. Can anybody explain to me what I’m doing wrong in building a CActiveForm using CForm?!?


I’ve sloved half the issue:

Both work, but the CForm-approach doesn’t work with the CWebLogRoute part of my logging configuration enabled:






                    'levels'=>'trace, info, error, warning',



                    'showInFireBug'=>true, // firebug only




                    'levels'=>'trace, info, error, warning, watch',






Once I disabled the CWebLogRoute part of the log configuration the CForm-based CActiveForm JQuery scripts worked. With this enabled, it didn’t. I assume it’s due to my use of Firebug.

Is this a bug? Anybody else experience this?