Select2: Submit Form

Hi, I’m using YiiWheel’s Select2 in my form but I can’t seem to pass the value from the widget. Can you guys help? An example would be nice. I couldn’t find answers from my searches. Here’s my code so far:

        $this->widget('yiiwheels.widgets.select2.WhSelect2', array(


            'model'=> $model,

            'attribute' => 'account_code_id',

            'asDropDownList' => true,

            'data' => array(

                'Account Codes' => AccountCode::model()->findAll($criteria)



Maybe I’m missing something?

<?php $this->widget('yiiwheels.widgets.select2.WhSelect2', array(




	'style'=>'width:100%; min-height:22px; ',


	'placeholder'=>'Product Model',


'data' => CHtml::listData( AccountCode::model()->findAll(

 		array('order' => 'name ASC')),






id is what’s saved and name is whats shown in the list

also note you can make multiple =>false to only allow one

if you save it as a string in your database (value1,value2) you will need to modify your actionupdate in your controller (you will need to explode it).


  $model->account_code_id = explode(',', $model->account_code_id);

if you don’t it will not show all of the values in the update only the first one

How these fields are validated?

I get an error because it is required and does not send any value