hi
i have the following models:
-
assignment(id, studentID, behaviorID, …)
-
Student(id, name, classID, …)
-
Class(id, name, …)
in assignment/_form
i need to add a drop down list about all the classes in the database
so i write something like this:
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'classReport-form',
'enableAjaxValidation'=>false,
));
echo CHtml::dropDownList('studentClass','studentClass', CHtml::listData(Stclass::model()->findAll(), 'Class_Code', 'E_Class_Abbreviation'), array('empty'=>'Select Class'));
//echo $form->dropDownList($model,'BehavType', array('1' => 'Positive Behavior', '2' => 'Negative Behavior', '3' => 'All Behavior Types'), array('empty' => '(Select a Behavior Type)'));
echo $form->dropDownList($model,'BehavType', array(Yii::app()->params['bType']));
echo CHtml::button('Generate', array('submit' => array('Assignment/classReport')));
$this->endWidget();
?>
in Assignment controller, classReport action:
public function actionClassReport()
{
$behaviorType = $_POST['Assignment']['BehavType'];
$stClass = $_POST['Assignment']['studentClass'];
$this->redirect(array('site/page/view/classReport', 'BehavType'=>$behaviorType, 'studentClass'=>$stClass));
}
there is an error: undefined index: studentClass
can someone tell me how to pass such a parameter?
thank you