/**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return User the loaded model
  * @throws CHttpException
  */
 public function loadCarTypesModel($id)
 {
     $model = CarTypes::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public static function getCarTypes()
 {
     return CHtml::listData(CarTypes::model()->findAll(), 'id', 'name');
 }
<!--提示信息展示-->
<?php 
if (Yii::app()->user->hasFlash('addsuccess')) {
    $this->redirect_message('添加成功', 'success', 3, Yii::app()->createUrl('customer/index'));
} else {
    if (Yii::app()->user->hasFlash('updatesuccess')) {
        $this->redirect_message('修改成功', 'success', 3, Yii::app()->createUrl('customer/index'));
    }
}
?>

<?php 
echo CHtml::link('返回', array('customer/createCar'));
?>
<p class="help-block">带 <span class="required">*</span> 为必填项.</p>

<?php 
echo $form->textFieldRow($model, 'licenseNumber', array('class' => 'span4'));
echo $form->dropDownListRow($model, 'type_id', CarTypes::getCarTypes());
?>
<div class="form-actions">
    <?php 
$this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'label' => $model->isNewRecord ? '添加' : '修改', 'type' => 'primary'));
?>
</div>
<?php 
$this->endWidget();
?>