How to call AJAX on check-box of form API? I need to get radio buttons in a form, whenever a checkbox gets enabled/clicked.
Say, I have 5 items listed in a checkbox, named orange, apple, .....When I enable orange checkbox, a set of radio button comes that will ask color of the corresponding fruit. Any working example regarding this will be highlyy appreciated.

EDIT:

$form['toggle_me'] = array(
  '#type' =&gt; 'checkboxes',
  '#title' =&gt; t('Tick this box to type'),
   '#options' =&gt; array(0 =&gt; t('Orange'), 1 =&gt; t('Apple')),
);
$form['settings'] = array(
  '#type' =&gt; 'radios',
  '#states' =&gt; array(
    // Only show this field when the 'toggle_me' checkbox is enabled.
    'visible' =&gt; array(
      ':input[name="toggle_me"][#options][0]' =&gt; array(0 =&gt; t('red'), 1 =&gt; t('yellow')),
    ),
  ),
);
Try This, may be helpful for you

$form['checkbox'] = array(
    '#title' =&gt; 'Select',
    '#type' =&gt; 'checkboxes',
    '#options' =&gt; drupal_map_assoc(array(t('Orange'), t('Apple'))),
    '#ajax' =&gt; array(
      'callback' =&gt; 'fruits_callback_form',
      'wrapper' =&gt; 'fruit-check',
      'method' =&gt; 'replace',
      'effect' =&gt; 'fade',
    ),
  );
  $checkbox = !empty($form_state['values']['checkbox']) ? $form_state['values']['checkbox'] : 0;
  $form['slots']['#prefix'] = '&lt;div id="fruit-check"&gt;';
  if ($checkbox == 'Orange') {
    $color = array(0 =&gt; t('Red'), 1 =&gt; t('Blue'));
  }
  $form['color'] = array(
    '#type' =&gt; 'radios',
    '#title' =&gt; t('Select Color'),
    '#options' =&gt; $color,
  );
  $form['slots']['#suffix'] = '&lt;/div&gt;';


  //Callback function

  function fruits_callback_form($form, &amp;$form_state) {
    return $form['color'];
  }