Cjuiautocomplete can automatically prompt the user to enter text based on the first few characters entered by the user when the user enters. It encapsulates the JUI autocomplete plugin.
Basic usage is as follows
$this->widget (' Zii.widgets.jui.CJuiAutoComplete ', Array (' name ' = ' City ', ' source ' = = $data,//additional JavaScript options for the AutoComplete plugin ' options ' =>array (' minLength ' = ' 2 ',), ' Htmloptions ' =>array (' Style ' = ' height:20px; '),);? >
The automatically prompted data source is completed by configuring the Source property, which can be actually applied by reading the database, files, etc. For simplicity, this example uses an array definition in Sitecontroller.
Public Function Actionindex () {$data =array (' Nanjing ', ' Beijing ', ' Perth ', ' Chicago ', ' Paris ', ' Pengnai ', ' Sydney '); This->render (' index ', array (' data ' = $data,));}
The above is the PHP Development Framework Yii Framework Tutorial (zii)-autocomplete sample content, more relevant content please focus on topic.alibabacloud.com (www.php.cn)!