Hello. I have a button, when click on which it sends ajax request to controller action and action render partial the view.
The button is in the "view.php". the button is
<?php echo CHtml::ajaxLink(CHtml::image(Yii::app()->theme->baseUrl."/images/edit1.png"), array('player/uurchluh'),
array(
'data'=>array('id'=>$model->id),
'type'=>'post',
'success'=>'js:function(data){
$("div.updateform").append(data);
}',
));?>
The controller action is
public function actionUurchluh()
{
if(Yii::app()->request->isAjaxRequest)
{
$id=$_POST['id'];
$model= Player::model()->findByPk($id);
echo $this->renderPartial('_formUpdate', array('model'=>$model));
}
}
The "uurchluh.php" view which is partial rendered is
<?php $form=$this->beginWidget('CActiveForm',
array(
'id'=>'update-player',
'enableClientValidation'=>true,
'action'=>CHtml::normalizeUrl(array('player/update')),
));?>
<div class="updateRow">
<label class="genericLabel"><?php echo $attr['tovchlol']?>:</label>
<?php echo $form->textField($model,'tovchlol', array('size'=>5,'maxlength'=>5, 'class'=>'genericInput'))?>
<?php echo $form->error($model,'tovchlol'); ?>
</div>
<div class="updateRow">
<label class="genericLabel"><?php echo $attr['ovog']?>:</label>
<?php echo $form->textField($model,'ovog',array('size'=>20,'maxlength'=>20, 'class'=>'genericInput')); ?>
<?php echo $form->error($model,'ovog'); ?>
</div>
<div class="updateRow">
<label class="genericLabel"><?php echo $attr['ner']?>:</label>
<?php echo $form->textField($model,'ner',array('size'=>20,'maxlength'=>20, 'class'=>'genericInput')); ?>
<?php echo $form->error($model,'ner'); ?>
</div>
<div class="updateButtons">
<?php echo CHtml::submitButton("Save", array('class'=>'saveUpdate'));?>
</div>
<?php $this->endWidget();?>
The form is submitted to player/update action. When form is submitted and if there are validation errors, how to render form errors in the "view.php"?