[Solved] Strange Behavior Of "value" Parameter In Cjuiautocomplete

Hello yiiers,

when I try to update an object model with some fields that are editable with CJuiAutoComplete, the given values are:

1/ well displayed in the autocomplete field, if the value is directly extracted from the model object

2/ displayed outside the autocomplete field if the way I access the value is a bit more tricky:

This is the generated code:

<input name="Vol[cdtbord]" id="Vol_cdtbord" type="hidden" value="P256" />	Here I have the nomPrenom value (see below)<input style="margin-right:10px" class="span2" id="Vol_cdtbord_nom" type="text" value="" name="Vol[cdtbord_nom]" />

Note that the "value" data in the input is empty.

Form code:

	<?php echo $form->hiddenField($model,'cdtbord'); ?>

	<?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(






			'select' => 'js:function(event, ui){ jQuery("#Vol_cdtbord").val(ui.item["id"]); }'








The getPilot function:

	public function getPilote($code)


		$pilotesListe = simplexml_load_file('xml/pilotes.xml');

		$search = "//pilote[code='$code']";

		$pilotes = $pilotesListe->xpath($search);

		foreach($pilotes as $pilote){echo $pilote->nomPrenom;}


I know that the foreach is not really elegant for accessing an unique element (each pilot has a unique code)

Example of the xml data:


<pilote><code>P256</code><nomPrenom><![CDATA[JOHN DOE]]></nomPrenom>

others pilot data



another pilot datas




I don’t know how to explain that :-[


in the function getPilot, I’ve replaced the “echo” with “return”

easy …