PHP Development Framework YII Framework Tutorial (d) zii component-autocomplete sample

Source: Internet
Author: User
Tags array definition yii

Cjuiautocomplete can automatically prompt the user to enter text according to the first few characters entered by the user when entering. It encapsulates the JUI AutoComplete plug-in.

The basic usage is as follows

<?php
$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; ')
			;
 
? >

Automatically prompts the data source by configuring the Source property to complete, the actual application can be read through the database, files and so on. 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
 
			);
}

See a full set of tutorials: http://www.bianceng.cn/webkf/PHP/201301/35265.htm

This example downloads: Http://www.imobilebbs.com/download/yii/JuiAutoCompleteDemo.zip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.