When trying to add captcha to the form builder the following error occures:
Fatal error: Method CForm::__toString() must not throw an exception in \protected\views\site\register.php on line 4
On line 4 is:
<?php echo $form; ?>
FORM BUILDER:
return array(
'elements'=>array(
'user'=>array(
'type'=>'form',
'title'=>'Login information',
'elements'=>array(
'username'=>array('type'=>'text'),
'password'=>array('type'=>'password'),
'email'=>array('type'=>'text'),
Yii::app()->controller->widget("CCaptcha", array(), true),
'capatcha' => array('type'=>'text')
'label' => Yii::t('form', 'Insert verification code'),
'type' => 'text',
)
)
),
....................................
),
'buttons'=>array(
'register'=>array(
'type'=>'submit',
'label'=>'Register'
)
)
);
USER MODEL:
public function rules()
{
return array(
array('username, password, email', 'required'),
array('username, password, email', 'length', 'max' => 128),
array('email', 'email'),
array('email', 'unique'),
array('username', 'unique'),
array('username, email', 'safe', 'on' => 'search'),
array('capatcha', 'captcha', 'allowEmpty'=>!extension_loaded('gd'))
);
}