Alert after form radio has been selected I am trying to use drupal ajax to test if an email address from the form it is in my database. For that i have altered the form and added the following line to the element:

   $form['field_radio']['#ajax'] = array
    (
       'callback' =&gt; '_get_member',
       'progress' =&gt; array('type' =&gt; 'throbber', 'message' =&gt; '')
    );


and the callback function:

function _get_member($form, $form_state){

     $sid = $form_state['values']['details']['sid'];
    $commands[] = ajax_command_alert("Hello World");    

    return array(
    'type' =&gt; 'ajax',
    'commands' =&gt; $commands
  ); 
}


As you can see from the callback i just want to return an alert message but it does not work. The callback is called because i have tested using watchdog but the alert popup never fires. Why ?
'wrapper' is a required key for #ajax on form elements, you're probably just missing that. From the docs


  This property is required for using AJAX requests in on a form element


If you add the wrapper it should work:

$form['field_radio']['#ajax'] = array (
   'callback' =&gt; '_get_member',
   'progress' =&gt; array('type' =&gt; 'throbber', 'message' =&gt; ''),
   'wrapper' =&gt; 'some-element-id'
);