ajax callback on form element checkboxes I am having some troubles with ajax on form element checkboxes, in ajax callback form_state is without values and triggering element etc .. why is that?

The form is called with drupal_get_form and this is my element

$form['select_options'] = array(
  '#type' =&gt; 'checkboxes',
  '#options' =&gt; $options, 
  '#ajax' =&gt; array(
    'callback' =&gt; 'ajax_options_callback',
    'wrapper' =&gt; 'options-form',
    'event' =&gt; 'change',
    'method' =&gt; 'replace',
  ),
);
When you use a callback $forms and $form_state is available for use in your callback. But you should call them as parameters in your callback definition.
So:

public function ajax_option_callback(array $form, FormStateInterface $form_state) {
  // get the id of the form
  $value = $form_state-&gt;getFormObject()-&gt;getFormId();
  // create a response object and return it
}

public function ajax_option_callback() {
  // $form and $form_state not available
}


Note that &amp;form_state-&gt;getTriggeringElement() contains nothing as the form is not submitted.

I realize now the question is for D7. Maybe my answer is usefull for someone within the D8 context.