Hi, i’ve got a big problem
i have a table
business_analyst
with
BA_ID
BA_NAME
and i would like in a CActive form, show all the BA_ID of business analyst only only in a dropDownList()
but i only managed to show
-just one BA_ID
or
-one line of BA_ID and BA_NAME
here is the code i tried
Controller
public function actionView($id)
{
$first_parent_instance = businessAnalyst::model()->find();
$is_owned_byRecords= isOwnedBy::model()->find();
$bonjour = businessAnalyst::model()->findBySql("select BA_ID from business_analyst");
$this->render('view',array(
'model'=>$this->loadModel($id),
'business_analystRecords'=>$this->getBusinessAnalystRecords($id),
'first_parent_instance'=>$first_parent_instance,
'is_owned_byRecords'=>$is_owned_byRecords,
'bonjour'=>$bonjour
));
}
View
//Form that enables to create a new is_service
$form=$this->beginWidget('CActiveForm', array(
'id'=>'functional-domain-form',
'enableAjaxValidation'=>false,
));
//we stock the dropDownList contents into a $form that we put into variables we re use in the CdetailView Widget
$varBA_NAME = $form->dropDownList($bonjour,'BA_ID', $bonjour);
$varFUNCTIONAL_DOMAIN_ID = $form->hiddenField($is_owned_byRecords,'FUNCTIONAL_DOMAIN_ID');
//creation of the button add that re direct to the Create.php of the isService view ( protected/view/isService/create.php)
$ButtonAdd=CHTml::button('Add', array(
'submit'=>Yii::app()->createUrl("isOwnedBy/create")
));
?>
<h1>Add new Business Analyst</h1>
<?php
$this->widget('zii.widgets.CDetailView', array(
'data'=>$business_analystRecords,//childrecord is a variable not really usefull but we must put a variable of type IsService::model()
'attributes'=>array(//creation of the lines
array(
'label'=>'BA ID',
'value'=>"$varBA_NAME",
'type'=>'raw',
),
array(
'value'=>"$ButtonAdd",
'type'=>'raw',
),
array(
'value'=>"$varFUNCTIONAL_DOMAIN_ID",
'type'=>'raw',
),
),
));
$this->endWidget(); //endForm