background image

 

if

(

$_GET

['action'] == 'getAjaxInfo'){ 

//这里由于我写其它应用了,如果单纯做这一个自动完成,可以写简单一点 
if

(

$_GET

['name'] != ''){ 

$field

 = 'name'; 

if

(

$field

 != ''){ 

$val

 = 

$_GET

['$field']; 

$sql

 = "select `$field` from doctor_info where $field like '%$val%'"; 

$rst

 = 

$aa

->execute(

$sql

); 

while

(

$row

 = mysql_fetch_array(

$rst

)){ 

echo

 

$row

[0]."\n"; 


exit

直接运行即可实现

 。

下面贴出来

autocomplate 的一些公共用法,从别的站上面粘过来的,参考方便 

属性

类型

描述

actionPrefix

string

actionsID 的前缀.

attribute

string

这个 widget 相关的属性.

autoFill

boolean

选择一个值时自动填充 textinput, 替换已经键入的或选择的值.

cacheLength

integer

存储在 cache 中的后台查询结果的数目.

controller

CController

返回这个小物件所属的 controller.

cssFile

mixed

这个 widget 使用的 CSS 文件.

data

array

保存在客户端提供候选选择项的数据.

delay

integer

当键入后,autocompleter 等待多少毫秒激活 .

extraParams

array

后端的附加参数.

formatItem

string

为一个 item 提供高级标记的 javascript 函数.

formatMatch

string

用来限制 autocomplete 搜索匹配的数据的 javascript 函数 .

formatResult

string

在结果放入 input 字段前,提供格式化值的 javascript 函数 .