Check new form-input against old form-input I have added some extra options in the My Profile page which users can edit. But now I have to track down the change of this value...

It's a checkbox and whenever the user (un)checks this box, something must happen. So I thought this would be in the $form_state, but no luck there.

Next thing I did was to preform an EntityQuery on the user object and try to cross-reference it with the input, but again, no luck.

So how can I (programmatically) detect if a form-element goes from unchecked to checked or the other way around?

EDIT: What I try to do is an implementation with Campaign Monitor (a newsletter plugin). If a user has changed it's checkbox, his subscription must be updated (of leave it as it is when there is no change)
When you change something in form, that change can be found in $form_state. You need to add an AJAX callback and do your changes in that callback.

Sample code:

function MYMODULE_form_alter(&amp;$form, $form_state, $form_id) {
  switch ($form_id) {
    case 'MY_FORM_ID':
      $form['field_select']['#ajax'] = array(
        'event' =&gt; 'change',
        'callback' =&gt; 'your_ajax_callback',
        'progress' =&gt; array('type' =&gt; 'none'),
      );
    break;
  }
}

/**
 * AJAX Callback.
 */
function your_ajax_callback(&amp;$form, &amp;$form_state) {
  // dpm($form_state);
  // Check $form_state here and update subscription.
}


Hope this helps!