With states, how to uncheck a disabled checkbox, but not check it when it becames enabled? I have a Form API checkbox that can be enabled and disabled by another ("parent") one:

$form['my_checkbox']['#states'] = array(
  'enabled' =&gt; array(
    ':input[identifier="parent"]' =&gt; array('checked' =&gt; TRUE),
  ),
);


Works like a charm, but now I want it to get cleared if it is dizabled. So I made my code look like this:

$form['my_checkbox']['#states'] = array(
  'enabled' =&gt; array(
    '[:input[identifier="parent"]' =&gt; array('checked' =&gt; TRUE),
  ),
  'unchecked' =&gt; array(
    ':input[identifier="self"]' =&gt; array('disabled' =&gt; TRUE),
  ),
);


Sadly, this also automatically checks that checkbox when it becomes enabled, and that's not what I want - I want to give my user an option, but not suggest him to check that field at all.

Can this "one way" action be achieved with '#states'? If so, how? Or is it always two way deal, and there is no option to uncheck on disabling without checking on enabling?

Note: I tried to use both disabled and enabled of self, and checked &amp; unchecked of parent, with the same results.

I know I can achieve it with behavior, that's how I have it done now, but states api is there to avoid behavior's complexity and my use case seems pretty simple.
Turns out that with current implementation of states it is not possible. When condition gets true, state is applied, and when it gets false, state gets removed. No way around it so far, not without hacking core, so it's more feasible to write custom behaviors instead.