Yii Dropdown Onchange

thanks for your time fabrizio. finally i found the answer.

i leave the answer below, in case somebody face similiar problem.

this ‘update’=>’#category_id’, must be changed to this ‘update’=>’#Blog_category_id’,

and use


echo $form->dropDownList($model, 'category_id', array(), 

array('prompt'=>'Select topic')); 

and then save … and its saveeeeed … ;D

I want that, when I enter country then related to that country, states are display and when ! enter state then related to that country and state, city dropdown display,

this is my code

    <?php $country = Country::model()->findAll(); ?>


    


    <div class="row">


	<?php echo $form->labelEx($model,'country'); ?>


	<?php echo $form->dropDownList($model,'country',CHtml::listData($country, 'name', 'name'),array('empty'=>'- - select one - -','class'=>'form-control', 'id'=>'check_country', 'onchange'=>' var country_name = this.value;')); ?>


	<?php echo $form->error($model,'country'); ?>


</div>


    <?php $state = State::model()->findAll(); ?>


    


<div class="row">


	<?php echo $form->labelEx($model,'state'); ?>


	<?php echo $form->dropDownList($model,'state',CHtml::listData($state, 'name', 'name'),array('empty'=>'- - select one - -','class'=>'form-control', 'id'=>'check_state')); ?>


	<?php echo $form->error($model,'state'); ?>


</div>


    


    <?php $state = State::model()->findAll(); ?>


    


<div class="row">


	<?php echo $form->labelEx($model,'city'); ?>


	<?php echo $form->dropDownList($model,'city',CHtml::listData($state, 'name', 'name'),array('empty'=>'- - select one - -','class'=>'form-control', 'id'=>'check_city')); ?>


	<?php echo $form->error($model,'city'); ?>


</div>