Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 294800

conditional visibility of a managed_file using #states attribute does not work in Drupal 8

$
0
0

I have the following code in form

$share_type[] = 'value1';
$share_type[] = 'value2';
$share_type[] = 'value3';

  $form['share'] = array(
    '#type' => 'radios',
    '#options' => $share_type,
    '#default_value' => 0,
);
$form['document'] = array(
      '#type' => 'managed_file',
      '#upload_location' => 'public:/document/',
      '#upload_validators' => array(
        'file_validate_extensions' => array('txt doc docx xls xlsx pdf ppt pptx'),
        'file_validate_size' => array(1024 * 1024 * 5),
      ),
       '#states' => array(
        'visible' => array(
          ':input[name="share"]' => array('value' => "2"),
        )
      ), 
      '#title' => t('Choose a file'),
      '#title_display' => 'invisible',
      '#size' => 22,
    );  

I want to display document field when the radio button field is having a value 2 . Its working for fields when its having a text area as a type . Its not working for managed_file as a type .


Viewing all articles
Browse latest Browse all 294800

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>