0

我正在使用这段代码。如何将值放入变量中,例如 $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>;
4

1 回答 1

0

阅读此http://api.jqueryui.com/autocomplete/事件部分。使用selectchange事件

$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
于 2012-11-26T05:16:49.783 回答