I have spent hours trying to research this with little findings. I am simply trying to get this example to work: http://www.yiiframew…oc/cookbook/24/
I've set everything up, and as I watch the requests, I notice that this code is passing nothing to my controllers allotted method. the parent_id is not being sent. I've researched ajax in the api and there are only 2 parameters that don't seem to do it for me.
however I have gotten somewhere, if I hard code my value in the url it does work for that hardcoded value. For instance
my view:
<?php echo CHtml::dropDownList('Gen1','',CHtml::listData($typeItem,'id','title'), array( 'ajax'=> array( 'type'=>'POST', 'url'=>CController::createUrl('item/updateGen&Gen1=7'), 'update'=>'#Gen2', ) )); echo CHtml::dropDownList('Gen2','', array());?>
and my Controller method:
public function actionUpdateGen() { $data=ItemType::model()->findAll('master_id=:master_id', array(':master_id'=>(int) $_GET['Gen1'])); $data=CHtml::listData($data,'id','title'); foreach($data as $value=>$title) { echo CHtml::tag('option', array('value'=>$value),CHtml::encode($title),true); } }
I had to change the query line to use Get method but it works for that one id. However i need it to dynamically pull the IDs. I tried
‘url’=>CController::createUrl(‘item/updateGen&Gen1=$this->id’),
and nothing.
Any help would be vastly appreciated