Chosen Extension


I have used Chosen extension for product dropdownlist. When I select value from dropdownlist and submit form and if there is validation issue on other inputs on the form then previous selected value from dropdownlist becomes unselected.


<?php /** @var BootActiveForm $form */

$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(




)); ?>


 <p class="note">Fields with <span class="required">*</span> are required.</p>

 <?php echo $form->errorSummary($model); ?>



// 		'model'=> $model,

		'name' => 'inputName', // input name

		'value' => '', // selection

		'data' => CHtml::listData(ProductType::model()->findall("edt IS NULL"), 'id', 'product_type'),


<?php echo $form->textFieldRow($model, 'name', array('class'=>'span3')); ?>

<?php echo $form->textFieldRow($model, 'specifications', array('class'=>'span3')); ?>

<div class="form-actions">

		<?php $this->widget('bootstrap.widgets.TbButton', array(



			'label'=>$model->isNewRecord ? 'Save' : 'Update',

		)); ?>

		<?php echo CHtml::link('<i class="icon-arrow-left"></i> Go Back',Yii::app()->request->urlReferrer,array('class'=>'btn'));?>


Finally I got solution

echo Chosen::activeDropDownList($model, "ptype", CHtml::listData(ProductType::model()->findall("edt IS NULL ORDER BY product_type"), 'id', 'product_type'), array());