PHP code example of nepttune / ajaxselect

1. Go to this page and download the library: Download nepttune/ajaxselect 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/ */

    

nepttune / ajaxselect example snippets


$form->addAjaxSelect('client_id', 'Klient', function (string $query, ?int $default = 0) {
      if ($default) {
          $row = $this->repository->getRow($default);
          return [$row->id => $row->name];
      }

      return $this->repository->search($query);
  })
  ->setPrompt('--- Vyberte ---')
  ->setRequired();