我正在使用此代码。如何将值放入变量中,比如$ temp?
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'patientSearch',
'source'=>$arr,
// additional javascript options for the autocomplete plugin
'options'=>array(
'minLength'=>'2',
),
'htmlOptions'=>array(
'style'=>'height:20px;'
),
));
$temp = <value of autocomplete form>;
答案 0 :(得分:0)
阅读此http://api.jqueryui.com/autocomplete/个活动部分。使用select
或change
个活动
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'patientSearch',
'source'=>$arr,
// additional javascript options for the autocomplete plugin
'options'=>array(
'minLength'=>'2',
'select' => 'js:function(event, ui) {
$temp = event.currentTarget.value;
}',
'change' => 'js:function(event, ui) {
$temp = event.currentTarget.value;
}',
),
'htmlOptions'=>array(
'style'=>'height:20px;'
),
));
var $temp = ''; // init global variable