#default_value for select form elements does not work &lt;?php
namespace Drupal\dishes_dropdown\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Routing\TrustedRedirectResponse;
use Drupal\Component\Utility\UrlHelper;

/**
 * Desarrollo de un formulario en drupal 8
 *
 */
class DishesDropdownForm extends FormBase {


    /**
     * {@inheritdoc}
     */
    public function getFormId() {
        return 'dishes_dropdown_form';
    }

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

        $maxlength = 250;

        $tax_terms = \Drupal::entityTypeManager()-&gt;getStorage('taxonomy_term')-&gt;loadTree('dish_type', $parent=0, $max_depth=NULL, $load_entities=FALSE);
        $taxs = array();
        foreach ($tax_terms as $tax_term) {
            $taxs[$tax_term-&gt;tid] = $tax_term-&gt;name;
        }

        $form['dish_dropdown'] = array(
            '#type' =&gt; 'select',
            '#options' =&gt; $taxs,
            '#chosen' =&gt; true,
            '#multiple' =&gt; false,
            '#maxlength' =&gt; $maxlength,
            '#default_value' =&gt; $form_state-&gt;hasValue('dish_dropdown') ? $form_state-&gt;getValue('dish_dropdown') : '' ,

        $form['submit'] = [
            '#type'  =&gt; 'submit',
            '#value' =&gt; $this-&gt;t('Ir al tipo de plato'),
            '#weight' =&gt; 50,
        ];
        return $form;
    }

    /**
     * {@inheritdoc}
     */
    public function submitForm(array &amp;$form, FormStateInterface $form_state) {
        // Display result.
        $id = reset($form_state-&gt; getValues('dish_dropdown'));
        $aliasManager = \Drupal::service('path.alias_manager');
        // The second argument to getAliasByPath is a language code such as "en" or LanguageInterface::DEFAULT_LANGUAGE.
        $alias = $aliasManager-&gt;getAliasByPath('/taxonomy/term/' . $id);

        $url = new TrustedRedirectResponse($alias);
        if (isset($url)) {
            $form_state-&gt; setResponse($url);
        }

        return;


    }
}




I do not load the "default_value" in select. I have tried a thousand ways in the "build" but there is no way. I want a blank default value but without forcing it load it. It's like if you read the "default_value".
The #default_value for a select element should be an integer value matching an array key in the #options array. 


In your case, lets say 

$taxs = [5 =&gt; 'blue dish', 9 =&gt; 'red dish', 15 =&gt; 'green dish'];


Then an option for the value for *#default_value will be one of 5,9 or 15. 

In your case the function $form_state->hasValue('dish_dropdown') will return one of "blue dish", "red dish" or "green dish" which is not an array key in your $taxs array. 

So what do you do? 


Either select one of your dish types as the default OR
Add a default value - None -


For example:

$taxs[0] = '-- None --';
$reverseTaxs = array_flip($taxs);
$form['dish_dropdown'] = array(
        '#type' =&gt; 'select',
        '#options' =&gt; $taxs,
        '#chosen' =&gt; true,
        '#multiple' =&gt; false,
        '#maxlength' =&gt; $maxlength,
        '#default_value' =&gt; $form_state-&gt;hasValue('dish_dropdown') ? $reverseTaxs[$form_state-&gt;getValue('dish_dropdown')] : 0 ,

    $form['submit'] = [
        '#type'  =&gt; 'submit',
        '#value' =&gt; $this-&gt;t('Ir al tipo de plato'),
        '#weight' =&gt; 50,
    ];
    return $form;