CAutoComplete with Key => Value Pairs

I am trying to get CAutoComplete to work with Key => Value Pairs so that the field autocompletes the key, but upon form submission the values are returned. As an example:

<?php echo $form->labelEx($model,'fruit_id'); ?>


		// Get the fruits (id, name) data

		$fruits = fruits::model()->findAll();

		$fruit_codes = array();

			foreach($fruits as $fruit)


				$fruit_codes[$fruit->name] = $fruit->id;



		$this->widget('CAutoComplete', array(








	<?php echo $form->error($model,'fruit_id'); ?>

Is there a way to do this with the CAutoComplete widget? If not, is there an alternative way in Yii of autocompleting keys and returning values withing a form?

NOTE: moved to proper section (General Discussion for Yii 1.1.x instead of Bug Discussion)