Dropdown Update

Hi All,

In need of some help here, thanks.

I have an Asset form in which Consumable can be added along with the new Asset record. The Asset and Consumable are 2 separate models. I’m using Joblo’s extension (multimodel) to add Consumable when I’m creating a new Asset record. The Consumable consist of 3 input fields, 1 of the input is a drop-down list of consumable type.

The consumable type drop-down list has an ‘Add New…’ option that allows user to add new consumable type if no matching consumable type is found in the existing drop-down list. I’m using a pop-up dialog from the following extension (CJuiDialog) to add new consumable type.

The problem I’m having happens when I try to add new consumable type to the drop-down list, the newly added consumable type is only reflected in the first drop-down (having multiple consumable drop-down when multiple consumable is added along with the new Asset).

How can I properly update the respective drop-down list in which the ‘Add New…’ is selected from?

The following codes are my implementation,

Asset Form:

$consumableFormConfig = array(







					        'onchange'=>"javascript: {

						        if(this.value == 'addNew') {



						              return false;



















$this->widget('ext.multimodelform.MultiModelForm', array(


		'addItemText'=>'Add Consumable',






		'data'=>empty($validatedItems) ? $consumable->findAll(


				      'params'=>array(':assetId'=>$model->id),)) : null,








			'htmlOptions'=>array('class'=>'row')),), true),


function addConsumable()


		<?php echo CHtml::ajax(array(

				'url'=>array('dropdown/create', 'model'=>get_class($consumable)),






					if(data.status == 'failure')


						$('#dialogConsumable div.consumableForm').html(data.div);

						$('#dialogConsumable div.consumableForm form').submit(addConsumable);




						$('#Consumable_type_id').prepend('<option value=\"' + data.value[0] + '\">' + data.value[1] + '</option>');							

						$('#Consumable_type_id option[value=\"' + data.value[0] + '\"]').attr('selected', true);

						$('#dialogConsumable div.consumableForm').html(data.div);					

						setTimeout(\"$('#dialogConsumable').dialog('close') \", 1000);							



			)) ?>;		

		return false;




	$this->beginWidget('zii.widgets.jui.CJuiDialog', array(



					'title'=>'Create Consumable Type',






	)); ?>

	<div class="consumableForm"></div>

<?php //End dialog 

	$this->endWidget(); ?>

Any help or alternative solution is greatly appreciated. Thanks in advance.

If additional information for the above mentioned problem is needed, please inform me. Thanks.