好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

Yii -AutoComplete 表单自动提示

CJuiAutoComplete 在用户输入时可以根据用户输入的前几个字符自动提示用户可以输入的文字。它封装了 JUI autocomplete插件。

基本用法如下:

controller层代码:

——————————————-

<?php

class SiteController extends Controller

{

public function actionIndex()

{

$data=array(‘Nanjing’, ‘Beijing’, ‘Perth’,

‘Chicago’,'Paris’,'Pengnai’,'Sydney’);

$this->render(‘index’, array(

‘data’ => $data,

));

}

}

 

view层代码:

——————————————————

<?php

$this->widget(‘zii.widgets.jui.CJuiAutoComplete’, array(

‘name’=>’city’,

’source’=>$data,

‘options’=>array(

‘minLength’=>’1′,//设置文本框中有最少有几个字符的时候开始提示

),

‘htmlOptions’=>array(

’style’=>’height:20px;’

),

));

?>  

查看更多关于Yii -AutoComplete 表单自动提示的详细内容...

  阅读:54次