Sure. Here they are, I removed the comments and the code for the other controls in the form in order to make the sample shorter :
The action :
public function actionUpdate($id) {
$model = $this->loadModel($id);
if (isset($_POST['AccountingEntry'])) {
[... process submit and redirect ...]
$this->redirect(array('admin'));
}
$this->render('update', array(
'model' => $model,
'accounts' => Account::model()->findAll(array('order' => 'name')),
'thirdParties' => ThirdParty::model()->findAll(array('order' => 'name')),
));
}
The view :
<?php
$this->breadcrumbs = array(
'Ecritures' => array('index'),
'Edition',
);
$this->menu = array(
array('label' => 'Ecritures', 'url' => array('index')),
array('label' => 'Gérer les écritures', 'url' => array('admin')),
array('label' => 'Ajouter une ligne', 'url' => array('create')),
array('label' => 'Consulter', 'url' => array('view', 'id' => $model->id)),
);
?>
<h1>Editer la ligne #<?php echo $model->id; ?></h1>
<?php
echo $this->renderPartial('_form', array(
'model' => $model,
'accounts' => $accounts,
'thirdParties' => $thirdParties,
)
);
?>
The form partial :
<div class="form">
<?php
$form = $this->beginWidget('CActiveForm', array(
'id' => 'accounting-entry-form',
'enableAjaxValidation' => false,
));
?>
<?php echo $form->errorSummary($model); ?>
<div class="row">
<?php echo $form->labelEx($model, 'account_id'); ?>
<?php echo $form->dropDownList($model, 'account_id', CHtml::listData($accounts, 'id', 'name')); ?>
<?php echo $form->error($model, 'account_id'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model, 'entry_date'); ?>
<?php echo $form->dateField($model, 'entry_date'); ?>
<?php echo $form->error($model, 'entry_date'); ?>
</div>
[more rows...]
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Créer' : 'Enregistrer'); ?>
</div>
<?php $this->endWidget(); ?>
</div>