I created a dropDownList with values I get from a model I created. In my OptionRecord model, I have this code
public function getProposedMode(){
return array(
'Public Bidding',
'Direct Contracting',
'Shopping',
'Negotiated',
'Small Value',
);
}
In my controller, I add the ff. lines on my actionCreate
public function actionCreate()
{
$options = new OptionRecord();
$model=new PurchaseRequest;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['PurchaseRequest']))
{
$model->attributes=$_POST['PurchaseRequest'];
$model->proposed_mode = $options->getProposedModeatIndex($model->proposed_mode);
if($model->save()){
$this->redirect(array('view','id'=>$model->id));
}
}
$model->proposed_mode = $options->getProposedModeIndex($model->proposed_mode);
$this->render('create',array(
'model'=>$model,
));
}
Where did I go wrong? please help. thank you.