我是 yii 的新手,我正在创建下拉菜单。我遇到了错误,请建议我。这是我的下拉代码
<?php
/* @var $this CreateproductController */
/* @var $model Createproduct */
/* @var $form CActiveForm */
?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'createproduct-form',
'method'=>'post',
// Please note: When you enable ajax validation, make sure the corresponding
// controller action is handling ajax validation correctly.
// There is a call to performAjaxValidation() commented in generated controller code.
// See class documentation of CActiveForm for details on this.E0E0E0 EFF0F2
'enableAjaxValidation'=>false,
)); ?>
<?php echo $form->errorSummary($model); ?>
<div class="row" style="background-color: #F7F7F7; height:30px;">
<?php echo $form->labelEx($model,'Product Type'); ?>                
<?php echo CHtml::dropDownList($model,'pr_name',$model->getTypeOptions() ); ?>
<?php echo $form->error($model,'pr_type'); ?>
</div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save',array('class'=>'button1')); ?>
</div>
<?php $this->endWidget(); ?>
</div>
getTypeOptions() 方法在该方法内部使用并声明为以下常量
const CAT_EMPTY=0;
const CAT_PHONE=1;
const CAT_ROUTERS=2;
const CAT_ACCESSORIES=3;
const CAT_SERVICES=4;
public function getTypeOptions()
{
return array(
self::CAT_EMPTY=>'Select_Category',
self::CAT_PHONE=>'Phones',
self::CAT_ROUTERS=>'Routers',
self::CAT_ACCESSORIES=>'Accessories',
self::CAT_SERVICES=>'Services',
);
}
帮帮我..