AJAX callback function never called
I guess you are changing the id with '#attributes' =&gt; array('id' =&gt; 'foocats',),
And now the callback is not executed because the id is changed.

if you change your code it will work ( tested this in my own install )

$form['foocat']['subcategories'] = array(
  '#type' =&gt; 'select',
  '#default_value' =&gt; '',
  '#title' =&gt; $foocategory,
  '#options' =&gt; $options,
  '#ajax' =&gt; array(
    'callback' =&gt; 'edit_displayname_callback', 
    'wrapper' =&gt; 'displayname',
  ),
  //'#attributes' =&gt; array('id' =&gt; 'foocats',),
  '#prefix' =&gt; '&lt;div class="formselect MY_SPECIAL_JQUERY_SELECTOR" id="selectmapcat"&gt;',
  '#suffix' =&gt; '&lt;/div&gt;',
  '#size' =&gt; 9,
);