Custom form, input with ajax autocomplete not working I have developed a module with a custom form but I don't know why ajax autocomplete doesn't work. The form works good, but in one of the input field I'd like to have a autocomplete function. The next is part of my code:  

src\Form\Mycustomform.php 

...
public function buildForm(array $form, FormStateInterface $form_state, $parameter = NULL) {
...
    $form['customer'] = array(
      '#type' =&gt; 'textfield',
      '#title' =&gt; t('Customer'),
      '#id' =&gt; 'inpCustomer',
      '#autocomplete_route_name' =&gt; 'mymodule.autocomplete',
    );
....


mymodule.routing.yml

mymodule:
  path: 'mycustompath'
  defaults:
    _form: '\Drupal\mymodule\Form\Mycustomform'
    _title: 'Records'
  requirements:
    _permission: mycustompermission

mymodule.autocomplete:
  path: 'autocomplete'
  defaults:
    _controller: '\Drupal\mymodule\Controller\MyModuleController::autocomplete'
    _format: json
  requirements:
    _permission: 'access content' 


\src\Controller\MyModuleController.php

...
class MyModuleController extends ControllerBase {

    public function autocomplete(Request $request)
    {
        $string = $request-&gt;query-&gt;get('q');
        $matches = array();
        \Drupal:logger('autocomplete')-&gt;notice($string);
        $query = \Drupal::entityQuery('node');
        $query-&gt;condition('type','customers');
        $query-&gt;condition('title', '%'.$string.'%', 'like');
        $query-&gt;sort('title');
        $query-&gt;range(0,20);
        $entity = $query-&gt;execute();
        $nodos = \Drupal::entityTypeManager()-&gt;getStorage('node')-&gt;loadMultiple($entity);
        foreach ($nodos as $row) {
            $matches[] = array('value' =&gt; $row-&gt;getTitle(), 'label' =&gt; $row-&gt;getTitle());
        }

        return new JsonResponse($matches);
    }
}


If I see drupal log, I never get a register as expected. But if I see conosole log, I don't see ajax request. How could I find where is the problem? I think there isn't an ajax call when I write some letters on the input field. I don't see the circle on the right of the input that is shown when autocomplete is working.
After some tests I have found the problem. My code is right and it works good. The problem was the template file input--textfield.html.twig. Input textfield needs some automplete classes to work and this template deleted them to add some other classes. The required classes are: form-autocomplete form-text ui-autocomplete-input. I have changed this template file to add a new class I need but without deleting the other, and then, autocomplete works.