How to disable CACHE in FORM which loads database values in form fields
In the linked question the module Internal Page Cache was not enabled. If you don't want to disable page caching for all pages, but only for this form page, then add \Drupal::service('page_cache_kill_switch')-&gt;trigger() before you return the form:

/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {

// Define form fields.
$form['#cache']['max-age'] = 0;

$form['name'] = array(
  '#type' =&gt; 'textfield',
  '#size' =&gt; 80,
  '#title' =&gt; t('Your Name'),
  '#default_value' =&gt; $result-&gt;name,
);

\Drupal::service('page_cache_kill_switch')-&gt;trigger();

return $form;
}