Yii Render Update Inside View


I have model "Project" and i render inside view "tasks". I want to edit Tasks on the view.

I need something that:


-task [edit this task]

-task [edit this task]

-task [edit this task]

Now i have:






-Edit task(when I am click edit task, he is transferring me to the view of the edition of all tasks but i and I want after click to edit at tasks at once it moved me to the chosen task and edited this task)

How i can do it?

Not sure I quite get you but have you tried this:

echo CHtml::link('Edit this Task', array('task/update', 'id' => $task->id));

or are you trying to inline edits?


Matt i do it that:

I put this line :

<?php $this->renderPartial('_form', array('model' => $data)); ?>

and render "update" user but i heve next problem .

But your solution is very good idea :) and i use him .

When I am click at updates of the user and I am click save "update", then is error :

CCaptchaValidator.action "captcha" is invalid. Unable to find such an action in the current controller. 

some time ago I didn’t have a problem with validation.

My user rules :

array('verifyCode', 'captcha', 'allowEmpty' => !extension_loaded('gd')),

Try adding this to your controller:

public function actions()


        return array(

            // captcha action renders the CAPTCHA image displayed on the contact page

            'captcha' => array(

                'class' => 'CCaptchaAction'






Maybe this is good idea for validation. But now i heve "error validation":

Please fix the following input errors:

    The verification code is incorrect.

When i registering the user I must copy the code from the picture, and validate it.

But now is "update user" and this validate there is no…

You need to remove the Captcha from the form and model validation rules. If you post your code, I can help you.


User model :

public function rules() {

        // NOTE: you should only define rules for those attributes that

        // will receive user inputs.

        return array(

            array('name', 'length', 'max' => 128),

            array('email', 'length', 'max' => 255),

            array('password', 'length', 'max' => 40),

            array('status, group_id', 'length', 'max' => 45),

            array('id, name, email, password, status, group_id, username', 'safe', 'on' => 'search'),

            array('name', 'length', 'max' => 32, 'min' => 6),

            array('email', 'unique'),

            array('email', 'email'),

            array('verifyCode', 'captcha', 'allowEmpty' => !extension_loaded('gd')), //<-- this is validate Captcha remove it?



end user form:


/* @var $this UserController */

/* @var $model User */

/* @var $form CActiveForm */


<div class="form">

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



)); ?>

	<p class="note">Pola z<span class="required">*</span> muszą być wypełnione.</p>

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

	<div class="row">

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

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

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


	<div class="row">

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

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

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


	<div class="row">

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

		<?php echo $form->passwordField($model,'password',array('size'=>40,'maxlength'=>40)); ?>

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


	<div class="row">

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

		<?php echo $form->HiddenField($model,'status',array('size'=>45,'maxlength'=>45)); ?>

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


	<div class="row">

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

		<?php echo $form->HiddenField($model,'group_id',array('size'=>45,'maxlength'=>45)); ?>

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



	<div class="row buttons">

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


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

</div><!-- form -->

Yes - remove the last line from User model.

Ok Matt, All is correct :)

Matt, sorry for repeating, but VerifyCode in “registerForm” now it’s not validate .

Start a new topic so more people can help you.

In the meantime, you can add a scenario to the model.

array('verifyCode', 'captcha', 'allowEmpty' => !extension_loaded('gd'), 'on' => 'register'),

Then, in your register controller/action, you need to set the scenario to register.

$user->scenario = 'register';


Thanks Matt. All done :)