Yii用AutoComplete实现表单自动提示
发布时间:2023-05-10 编辑:jiaochengji.com
教程集为您提供Yii用AutoComplete实现表单自动提示等资源,欢迎您收藏本站,我们将为您提供最新的Yii用AutoComplete实现表单自动提示资源
Yii如何实现表单自动提示?CJuiAutoComplete组件在用户输入时可以过程中会自动提示用户可以输入的文字,它封装了jquery的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;' ), )); ?> |
您可能感兴趣的文章:
[关闭]