I made these 4dependent dropdownlist when I select the first , the second will update and when I select the second the third will update .....
but I want when I select the first all next 3 dropdown updated automatically.
these dropdownd in _form.php
$serv4=CHtml::listData(FullTableController::prov_func(),'prov','prov');
echo $form->dropDownList($model,'Province',$serv4,
array(
'ajax' => array(
'type'=>'POST',
'data'=>array('prov_n'=>'js:this.value'),
'url'=>CController::createUrl('FullTable/dynamiccities'),
'update'=>'#FullTable_Site_Name',
)));
////////////////////////////////////////////////////////////////////////////////////////////////////////
echo $form->dropDownList($model,'Site_Name',array(),
array(
'ajax'=>array(
'type'=>'POST',
'data'=>array('Site_Name'=>'js:this.value'),
'url'=>CController::createUrl('FullTable/dynamiccities2'),
'update'=>'#FullTable_Site_ID',
)));
////////////////////////////////////////////////////////////////////////////////////////////////////////
cho $form->dropDownList($model,'Site_ID',array(),
array(
'ajax'=>array(
'type'=>'POST',
'data'=>array('Site_id'=>'js:this.value'),
'url'=>CController::createUrl('FullTable/dynamiccities3'),
'update'=>'#FullTable_Servity',
)));
echo $form->labelEx($model,'Servity');
echo $form->dropDownList($model,'Servity',array());
echo $form->error($model,'Servity');
?>
FullTable Controller.php
public function actionDynamiccities()
{
$data=Sites::model()->findAll('prov_n=:prov_n OR " "=Site_Name ORDER BY Site_Name',
array(':prov_n'=> $_POST['prov_n']));
$data=CHtml::listData($data,'Site_Name','Site_Name');
foreach($data as $value=>$name)
{
echo CHtml::tag('option',
array('value'=>$name),CHtml::encode($name),true);
}
}
public function actionDynamiccities2()
{
$data=Sites::model()->findAll('Site_Name=:Site_Name OR " "=Site_Name ORDER BY Site_id',
array(':Site_Name'=> $_POST['Site_Name']));
$data=CHtml::listData($data,'Site_id','Site_id');
foreach($data as $value=>$name)
{
echo CHtml::tag('option',
array('value'=>$name),CHtml::encode($name),true);
}
}
public function actionDynamiccities3()
{
$data=Sites::model()->findAll('Site_id=:Site_id',
array(':Site_id'=> $_POST['Site_id']));
$data=CHtml::listData($data,'servity','servity');
foreach($data as $value=>$name)
{
echo CHtml::tag('option',
array('value'=>$name),CHtml::encode($name),true);
}
}