Chosen Extension

Hi

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.

View




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

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

    'id'=>'verticalForm',

                'focus'=>array($model,'ptype'),

    'htmlOptions'=>array('class'=>'well'),

)); ?>

 

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

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

<?php

$this->widget('ext.chosen.Chosen',array(

//              '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(

                        'buttonType'=>'submit',

                        'type'=>'primary',

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

                )); ?>

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

        </div>