Formbuilder and Captcha widget

Hi,

just tried to convert the default contact form into the new form builder CForm. I’ve no clue how to implement the CCaptcha widget. Any ideas?


<?php


return array(

    'elements' => array(

        'name' => array(

            'type' => 'text',

            'class' => 'span-6',

        ),

        'email' => array(

            'type' => 'text',

            'class' => 'span-6',

        ),

        'body' => array(

            'type' => 'textarea',

            'class' => 'span-6',

            'cols' => 50,

            'rows' => 10,

        ),

        Yii::app()->controller->widget('CCaptcha'),

        'capatcha' => array(

            'label' => Yii::t('form', 'Insert verification code'),

            'type' => 'text',

        ),

    ),

    

    'buttons' => array(

        'submit' => array(

            'type' => 'submit',

            'label' => Yii::t('form', 'submit'),

        ),

    ),

);

With Yii-1.1.2, you can solve your problem with


Yii::app()->controller->widget("CCaptcha", array(), true);

Thanks Eliovir! It solved my problem with CJuiDatePicker widget





'<div class="row field_dateBirth">

  <label class="required" for="Person_dateBirth">Date Birth <span class="required">*</span></label>'.

  Yii::app()->controller->widget("zii.widgets.jui.CJuiDatePicker", array(

    'name'=>'Person[dateBirth]','model'=>Person::model(),

    'options'=>array('showAnim'=>'fold',),

    'htmlOptions'=>array('style'=>'height:15px;',),

  ), true)

.'</div>',