Change states in hook form alter I am trying to change the states via the the following code:

function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  ...
  case 'my_form_node_form': {
    $form['my_file_field']['#states'] = array(
      'visible' =&gt; array(':input[id="my_id"]' =&gt; array('value' =&gt; 'my_value'),
    ),
  ); 
 }
}


but, my file field is not becoming visible after my input id is selected, instead is already visible.
If this is a file field attached to an entity, and not (for example) a managed_file element type, then the actual &lt;input&gt; element is contained further down the render array. At the moment you're probably attaching the JS to the wrong element (a container rather than the input).

Try something like this instead:

/**
* Implements hook_form_alter()
*/
function my_module_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  ...
  case 'my_form_node_form': {
    $form['my_file_field'][LANGUAGE_NONE][0]['fid']['#states'] = array(
      'visible' =&gt; array(
        ':input[id="my_id"]' =&gt; array('value' =&gt; 'my_value'),
      ),
    ); 
  }
}