Select2 not storing ID

Hi All,

I am using select2 extension.

But when trying to save (create) record even though I select from the list, it gives the error "Teilnehmer cannot be blank."


	$this->widget('ext.select2.ESelect2', array(


	        'attribute' => 'cTeilnehmerID',




			'placeholder'=>' -- please select -- ',





	public function actionAutoComplete() {


		$criteria = new CDbCriteria;

		$criteria->select = array('cTeilnehmerID','cVorname','cNachname');


		$criteria->addSearchCondition('cVorname',  strtoupper( $_GET['term']) ) ;

		$criteria->addSearchCondition('cNachname', strtoupper ( $_GET['term']), true, 'or');

		$criteria->addSearchCondition('CONCAT(cVorname," ",cNachname)', strtoupper ( $_GET['term']), true, 'or');


		$criteria->limit = 15;

		$data = Teilnehmer::model()->findAll($criteria);


		$res = array();


		foreach ($data as $item) {


			$res[] = array(

					'id' => $item->cTeilnehmerID,

					'value' => $item->fullName,

					'label' => $item->fullName,





		echo CJSON::encode($res);


How can I fix it?

I think you’ll get more help faster if you create issue here: