conditional visible form field How can i make the second field visible depending on the value selected in the first field ?

i have tried this but it does not work :

 $form['call-to-actions-widget']['call-to-actions-widget_select'] = [
      '#type' =&gt; 'select',
      '#title' =&gt; $this-&gt;t('widget options'),
      '#description' =&gt; $this-&gt;t('choisir un widget'),
      '#options' =&gt; [
        'none'=&gt;$this-&gt;t('none'),
        'year_navigation' =&gt; $this-&gt;t('exposed filter :year'),
        'row_max_unset' =&gt; $this-&gt;t('more publications ( block refresh )'),
        'internal_link' =&gt; $this-&gt;t('more publications ( internal link )'),
      ],
      '#default_value' =&gt; (!empty($config['call-to-actions-widget_select'])) ? $config['call-to-actions-widget_select'] : 'none'
    ];

    $form['call-to-actions-widget']['internal_link'] = [
      '#type' =&gt; 'textfield',
      '#title' =&gt; $this-&gt;t('internal link'),
      '#description' =&gt; $this-&gt;t('de type /node/56'),
      '#default_value' =&gt; (!empty($config['internal_link'])) ? $config['internal_link'] : ''
    ];

    $form['call-to-actions-widget']['internal_link']['#states'] = [
      'visible' =&gt; [
        [
          [':input[name="call-to-actions-widget_select"]' =&gt; ['value' =&gt; 'internal_link']]
        ],
      ],
    ];
Try this

$form['call-to-actions-widget']['internal_link']['#states'] = [
  'visible' =&gt; [
    ':input[name="call-to-actions-widget_select"]' =&gt; ['value' =&gt; 'internal_link'],
  ],
];


In case when it doesn't work use another selector 

':input[name="call-to-actions-widget[call-to-actions-widget_select]"]'


Or check in the browser name of the needed field. See e.g. where the name is password[pass1]