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 .