This article will introduce you to the Yii-AutoComplete form auto-Prompt instance. For more information, see. This article will introduce you to the Yii-AutoComplete form auto-Prompt instance. For more information, see.
Script ec (2); script
CJuiAutoComplete can automatically prompt users to enter text based on the first few characters. It encapsulates the JUI autocomplete plug-in.
The basic usage is as follows:
Controller Layer Code:
---------------
The Code is as follows: |
|
Class SiteController extends Controller { Public function actionIndex () { $ Data = array ('nanjing', 'beijing', 'perth ', 'Chicago ', 'Paris', 'pengnai', 'sydney '); $ This-> render ('index', array ( 'Data' => $ data, )); } } |
View Layer Code:
------------------
The Code is as follows: |
|
$ This-> widget ('zii. widgets. jui. CJuiAutoComplete ', array ( 'Name' => 'city ', 'Source' => $ data, 'Options' => array ( 'Minlength' => '1', // start when the text box contains at least a few characters ), 'Htmlopexception' => array ( 'Style' => 'height: 20px ;' ), )); ?> |