multiple dependent dropdown

Hi all,

I am using dependent drop down in my code which is working fine, but now i want multiple dependent dropdowns ie, choose from 1st dd n populate the 2nd dd, choose from the 2nd dd and populate the 3rd dd. The 2nd dd gets populated depending upon the first but when i choose from the 2nd dd the third dd is not getting populated.

I think this is happening because the 2nd dd gets over written and the code to populate the 3rd is lost.

my code in the form


  <div class="row">

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

		<?php 		echo $form->dropDownList($model, 'location_id', CHtml::listData(Location::model()->findAll(),'primaryKey', 'location'),  array(

				'prompt'=>'Select Location...', 

				'ajax' => array('type'=>'POST' 

                                , 'url'=>CController::createUrl('Quotation/choosebranch'), 

                                 'update'=>'#'.CHtml::activeId($model,'branch'),

                                     								

								)));

								?> 

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

	</div> 

     

     

    

     <div class="row" id="param_id">

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

		<?php echo $form->dropDownList($model,'branch',array(

				'prompt'=>'Select Branch...', 

				'ajax' => array('type'=>'POST' 

                                , 'url'=>CController::createUrl('Quotation/bankdetails'), 

							'data' => "js:{branch: $(this).val()}",


                                 'update'=>'#'.CHtml::activeId($model,'bank_details')


								

								)));

								?> 

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

	</div>  







	

	<div class="row">

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

		<?php  

		

		echo $form->dropDownList($model, 'bank_details',array('prompt' => 'Select bank') ); ?>

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

	</div>



Can anybody please shed some light on my problem.

Thanks

Hi,

try to create only list options on server side and instead of replacing whole dropdown list with new one replace all options