DotPlant2 documentation

Autocomplete widget

Autocomplete widget is used to automatically prompt results in the form of site search. At the time set in the request for input, he loads the appropriate results and displays them in a list below the input field. If some of them are suitable result, you can click on it and will switch to the appropriate page.

Minimum call widget might look like this:

$search = new \app\models\Search;
$form = \kartik\widgets\ActiveForm::begin(
       'action' => ['/search'],
       'method' => 'get',
       'id' => formid,

echo \app\widgets\AutoCompleteSearch::widget(
       'model' => $search,
       'attribute' => 'q',

It is called within the form widget and generates an input field input type=" text ". The input accepts the basic parameters:

  • model => search model
  • attribute => q, the name of the request parameter

Extra options:

  • clientOptions - array of options from
  • listClass - css class to the list of execution results in a tooltip
  • route - route to auto complete the action, the default '/default/auto-complete-search'