i tried also based on this website
_form is
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'assignment-form',
'enableAjaxValidation'=>false,
'enableClientValidation'=>true,
));
?>
<?php echo $form->dropDownList($model,'BehavType', array(Yii::app()->params['bType']),array('empty'=>'Select Type'),
array(
'ajax' => array(
'type'=>'GET', //request type
'url'=>$this->createUrl('Assignment/getBehaviorGroup'), //url to call.
//Style: CController::createUrl('currentController/methodToCall')
'data'=>array('BehavType'=>'js:this.value'),
//'data'=>array('BehavType'=>'js:this.value'),
//leave out the data key to pass all form values through
)));
//empty since it will be filled by the other dropdown
echo $form->dropDownList($model,'behavGroupID', array()); ?>
in Assignment controller
public function actionGetBehaviorGroup()
{
$data=Category::model()->GetCatOfType($_POST['BehavType']);//findAll('parent_id=:parent_id', array(':parent_id'=>(int) $_POST['BehavType']));
$data=CHtml::listData($data,'color','color');
foreach($data as $value=>$name)
{
echo CHtml::tag('option',array('value'=>$value),CHtml::encode($name),true);
}
//echo $_POST['BehavType'];
}
public function accessRules()
{
return array(
array('allow',
'actions'=>array('index','create','admin','view','update','assign', 'getBehaviorGroup'),
'roles'=>array('admin','BASAdmin','Assistant','Teacher'),
'users'=>array('@'),
),
}
there is no result, it seems that the first dropdownlist doesn;t even go to the controller. is there any errors in this code?