PHP code example of nepada / autocomplete-input
1. Go to this page and download the library: Download nepada/autocomplete-input library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nepada / autocomplete-input example snippets
trait FormControls
{
use Nepada\Bridges\AutocompleteInputForms\AutocompleteInputMixin;
public function addContainer($name)
{
$control = new Container;
$control->setCurrentGroup($this->getCurrentGroup());
if ($this->currentGroup !== null) {
$this->currentGroup->add($control);
}
return $this[$name] = $control;
}
}
class Container extends Nette\Forms\Container
{
use FormControls;
}
class Form extends Nette\Forms\Form
{
use FormControls;
}
$autocompleteInput = $form->addAutocomplete('foo', 'Foo', function (string $query) {
// return entries matching the query
});
$autocompleteInput->setAutocompleteMinLength(3); // set minimum input length to trigger autocomplete