How to check if managed_file has uploaded a video and use it in states
If you examine the comments in the documentation, there are several things to look out for:

You may need to target the element's widget, as mentioned in this comment. Most likely you would do this in a #process callback or in a form alter hook.


This is a good nuance to understand - thanks! Targeting the widget
worked for me on a number field. It gets ignored otherwise.

// My number field is hidden unless repeat is selected
$form['field_myfield_num']['#states'] = [
  'visible' =&gt; [
    ':input[name=&quot;field_myfield_select&quot;]' =&gt; ['value' =&gt; (string) 'repeat'],
    ],
];

// My number field is set as required when repeat is selected.
$form['field_myfield_num']['widget']['0']['value']['#states'] = [
  'required' =&gt; [
    ':input[name=&quot;field_myfield_select&quot;]' =&gt; ['value' =&gt;  (string) 'repeat'],
  ],
];


In the same comment above, we also see that sometimes it helps to cast your candidate value to a string: ['value' =&gt;  (string) 'repeat']. I've also seen this explicitly mentioned elsewhere, but can't find the reference.

It is possible to test for a negation using '!value', as seen in this comment:



I had a form with a field of #type select_or_other, which renders like
radios. I wanted to enable the submit button when the form element was
not &quot;none&quot;. The following worked for me:

$form['actions']['submit'] = [
  '#type' =&gt; 'submit',
  '#value' =&gt; $this-&gt;t('Donate'),
  '#button_type' =&gt; 'primary',
  '#states' =&gt; [
    'enabled' =&gt; [
      ':input[name=&quot;amount[select]&quot;]' =&gt; ['!value' =&gt; 'none'],
    ],
  ],