Cannot affect the visibility or requirement of managed_file with states. Identical to this issue:
https://www.drupal.org/node/1118016
With this definition:
$form['type'] = array(
'#type' => 'select',
'#options' => array(
'video' => t('Video'),
'audio' => t('Audio'),
'post' => t('Text'),
),
);
$form['audio'] = array(
'#type' => 'managed_file',
'#title' => t('Audio File'),
'#states' => array(
'visible' => array(':input[name="type"]' => array('value' => 'audio')),
'required' => array(':input[name="type"]' => array('value' => 'audio')),
),
'#upload_location' => 'public://',
'#upload_validators' => array(
'file_validate_extensions' => array('mp3 wac'),
'file_validate_size' => array(1048576),
),
);
I expect the visibility of "audio" to change when changing the value of "type". What happens is "audio" remains visible and not required. Simply changing "managed_file" to "file" brings the expected behavior.