在Yii框架中编辑动作

I am working on a web application that allow users to have video conferences. Users are allowed to create video conferences and I want them to be able to also edit the scheduled video conferences but I am having trouble implementing that. Please help.

Edit button in index.php view

 $html .=   CHtml::ajaxLink('Edit',
        Yii::app()->createAbsoluteUrl('videoConference/update/'.$vc->id),
        array(
            'type'=>'post',
            'data' => array('id' =>$vc->id,'type'=>'update'),
        ),
        array( "visible" =>  $ismoderator, 'role' => "button", "class" => "btn btn-info")
    );

Video conference Controller actionUpdate

/**
 * Updates a particular model.
 * If update is successful, the browser will be redirected to the 'view' page.
 * @param integer $id the ID of the model to be updated
 */
public function actionUpdate($id)
{
    $model = $this->loadModel($id);

    if (isset($_POST['VideoConference'])) {
        $model->attributes = $_POST['VideoConference'];
        if ($model->save())
            $this->redirect(array('view', 'id' => $model->id));
    }

    $this->render('edit', array(
        'model' => $model,
    ));

}

The first step is to find where is problem(frontend / backend). You need call action without ajax(just from url with param id). Try my version:

/**
 * Updates a particular model.
 * If update is successful, the browser will be redirected to the 'view' page.
 * @param integer $id the ID of the model to be updated
 */
public function actionUpdate($id)
{
    $model = $this->loadModel($id);
    if ($model == null) {
       throw new CHttpException(404, 'Model not exist.');
    }
    //if (isset($_POST['VideoConference'])) {
    //$model->attributes = $_POST['VideoConference'];

    $model->attributes = array('your_attr' => 'val', /* etc... */);
        // or try to set 1 attribute $model->yourAttr = 'test';
    if ($model->validate()) {
        $model->update(); //better use update(), not save() for updating.
        $this->redirect(array('view', 'id' => $model->id));
    } else {
        //check errors of validation
        var_dump($model->getErrors());
        die();
    }
    //}
    $this->render('edit', array(
        'model' => $model,
    ));
}

If on server side all working fine(row was updated) then check request params, console, tokens etc. Problem will be on frontend.

After troubleshooting a little I finally got it to work. On the view I am calling the actionUpdate method like this:

        $html .=   CHtml::button('Edit', array('submit' => array('videoConference/update/'.$vc->id), "visible" =>  $ismoderator, 'role' => "button", "class" => "btn btn-info"));

On the controller just changed

$model->save() to $model->update()

and it works perfectly fine.