How do I get values(id)
from a dropDownList
and pass them to another one using onChange
in yii?
<?php
echo $form->dropDownList($model,'sub_cat_id', array('promot'=>'-- Select --')+CHtml::listData(Catagories::model()->findAll(), 'id_cat', 'cat_name','cat_name'));
?>
This is the first box, I want to get the id and pass to send one where parent_id = 1
using onChange
:
<?php
echo $form->dropDownList($model,'sub_cat_id', array('empty'=>'-- Select --')+CHtml::listData(Catagories::model()->findAllByAttributes(array('parent_id'=>'1')),'id_cat','cat_name'));
?>