This tutorial, I will show you how to display captcha yii framework  in form by using available library.
In model class, create a public attribute name “ verifyCode “.
public $verifyCode;

add the rule for Captcha verify code.

array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),

In controller class, put the action for captcha.

public function actions()
 return array(
  // captcha action renders the CAPTCHA image displayed on the contact page

Now the final thing is display in View page.

<?php echo $form->textField($model,'verifyCode'); ?>
<?php $this->widget('CCaptcha'); ?>
<?php echo $form->error($model,'verifyCode'); ?>

By defautl, Yii support us the captcha in library. By using a few code, yii call itselft and display to our view.
The application will look like.