Help, I Need Display Data In Form Textfields With Ajax

I have a form to record people, i need that when entering the card number and remove the focus in the first textfield search the database if that person exists and load them to textfields name, lastname, address and age of the person with the identity card.

Here is the code of the form, I am new to yii, sorry so much trouble.




<?php

/* @var $this SolicitantesController */

/* @var $model Solicitantes */

/* @var $form CActiveForm */

?>


<div class="form">


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

	'id'=>'solicitantes-form',

	// Please note: When you enable ajax validation, make sure the corresponding

	// controller action is handling ajax validation correctly.

	// There is a call to performAjaxValidation() commented in generated controller code.

	// See class documentation of CActiveForm for details on this.

	'enableAjaxValidation'=>true,

)); ?>




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


	<div class="row">

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

		<?php echo $form->textField($model,'cardnumb',array('size'=>12,'maxlength'=>12, 'id'=>'cardnumb')); ?>

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

	</div>


	<div class="row">

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

		<?php echo $form->textField($model,'fname',array('size'=>60,'maxlength'=>100, 'id'=>'fname')); ?>

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

	</div>


	<div class="row">

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

		<?php echo $form->textField($model,'lname',array('size'=>60,'maxlength'=>100, 'id'=>'lname')); ?>

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

	</div>


	<div class="row">

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

		<?php echo $form->textField($model,'age',array('id'=>'age')); ?>

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

	</div>


	<div class="row">

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

		<?php echo $form->textField($model,'address',array('size'=>60,'maxlength'=>255, 'id'=>'address')); ?>

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

	</div>


	<div class="row buttons">

		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>

	</div>


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


</div>



Here is your solution

check #4 answer

http://www.yiiframework.com/forum/index.php/topic/7000-chtmltextfield-and-ajax

Cheers :)