I was wondering how do you create a dropdown list with an option "Create a new type" and when it is selected, it will shows a textbox on the side. Can it be done with CActiveForm?
<?php echo $form->dropDownList($model, 'vendor_id', $vendor_list) ?>
Thanks a lot.
You can pass a third parameter to the dropDownlist fuction that will hold it’s id/class something like:
<?php echo $form->dropDownList($model, 'vendor_id', $vendor_list, array('class'=>'vendorIDdropDown')) ?>
Then just use Jquery event ‘change’ on that class to capture the event and load new content based on the selection. Something like this:
// Run ajax callback to load data based on the selection