CJuiInputWidget or alternative

Hi, I’m looking at making a form with a drop down box where if the option is not in the box, I want to do a pop-up (modal) form to add this component via ajax and update the list. For now, my difficulty is understanding what widget/extension to use for this. With zii out now, I’m a little confused what to use. There’s a CJuiInputWidget in zii and a nice looking JUI extension available. Both seem to offer solutions, but I can’t get either to work. I would love if someone could show me a simple example of how to properly implement the CJuiInputWidget or similar widget.


Here’s what I’ve got going so far that appears as though it will do the trick. Please let me know if this is not the right technique.

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


    // additional javascript options for the dialog plugin


        'title'=>'Add New Supplier',




			'Add Item'=>'js:addSupplier',

			'Cancel'=>'js:function(){ $(this).dialog("close");}',




$supplier = new Supplier;

echo CHtml::activeLabelEx($supplier, 'supplier_name');

echo CHtml::activeTextField($supplier, 'supplier_name');


// the link that may open the dialog

echo CHtml::link('open dialog', '#', array(

   'onclick'=>'$("#mydialog").dialog("open"); return false;',


So this is basically the sample snippet given with the CJuiDialog. To get fields into the dialog, I created them myself in the content section. I will then harness javascript to ajax the new item and update my drop-down. Is this the right way?

I would do that way also. Creating InputWidget doesn’t seem right for what you are trying to accomplish. You sould create widget when there is possibility to reuse code.