Hi I am using following code to make dependent combobox :
In view :
<?php
echo $form->dropDownListControlGroup($model, 'DDCode',
CHtml::listData(dds_designations::model()->findAll
(array(
'select'=>'DDCode, DDName',
'distinct'=>true,
)) , 'DDCode', 'DOName')
, array('ajax' => array(
'type' => 'POST', //request type
'url' => CController::createUrl
('OrequestsController/createi')
,
'update' => '#' . CHtml::activeId
($model, 'Designation'),
'data' => array
('DDCode' => 'js:this.value'),
))
);
?>
// Designation which need be dependent on above combobox values
<?php $this->widget('ext.select2.ESelect2',array(
'model'=>$model,
'attribute'=>'Designation',
'data'=>CHtml::listData(Orequests::model()->getdesignations($_GET['r']), 'designation', 'designation',
'htmlOptions'=>array(
'style'=>'width:50%')
)); ?>
In Controller creati action :
public function actioncreatei()
{
echo "<option value=''>Select Value</option>";
if (isset($_POST['DDCode']))
{
$ddcode = $_POST['DDCode'];
if ($datalst = Orequests::model()->getdesignations($ddcode) )
{
foreach($datalst as $datar)
{
echo
CHtml::tag('optgroup', array('label'=>$datar['designation']),
CHTML::tag('option', array('value'=>$datar['designation']),
CHtml::encode($datar['designation']),true));
}}}}
The Controller action is not being performed .I have debugged it too after selection in combobox of DDCode, the controller action event don't get triggered at all.Permission has also been granted in accessrules function of controller.Not sure what mistake i m doing i have tested all remedies. Any Idea what mistake i am doing in code ?