problem using ajax callback in form I have a very simple form that has a select box of the terms in a vocabulary, and renders the selected term below it.  It seems that the first time I change the value in the select it renders the appropriate term, however every subsequent "change" event it uses what ever term I selected the first time.

The code is as follows

function jms_industry_lens_form($form, &amp;$form_state) {
    $values = array();

    // Load the vocabulary and collapse into an array that form api understands
    $vocabulary = taxonomy_vocabulary_machine_name_load('industry_lens');
    $terms = taxonomy_get_tree($vocabulary-&gt;vid);

    foreach($terms as $term) {
        $values[$term-&gt;tid] = $term-&gt;name;
    }   

    $form['industry_lens'] = array(
        '#type'             =&gt; 'select',
        '#options'          =&gt; $values,
        '#default_value'    =&gt; 0,
        '#required'         =&gt; TRUE,
        '#ajax'             =&gt; array(
            'callback'  =&gt; 'jms_industry_lens_form_ajax',
            'wrapper'   =&gt; 'edit-industry-lens-term',
        ),  
    );  

    $form['industry_lens_term'] = array(
        '#type'     =&gt; 'item',
        '#markup'   =&gt; _jms_render_term($terms[0]-&gt;tid),
    );  

    return $form;
}

/**
 * Ajax callback to change the rendered industry lens taxonomy term
 */
function jms_industry_lens_form_ajax(&amp;$form, &amp;$form_state) {
    $form['industry_lens_term']['#markup'] = _jms_render_term($form_state['values']['industry_lens']);
    $form_state['rebuild'] = TRUE;

    return $form['industry_lens_term'];
}
So try to use 

function jms_industry_lens_form($form, &amp;$form_state) {
    $values = array();

    // Load the vocabulary and collapse into an array that form api understands
    $vocabulary = taxonomy_vocabulary_machine_name_load('industry_lens');
    $terms = taxonomy_get_tree($vocabulary-&gt;vid);

    foreach($terms as $term) {
        $values[$term-&gt;tid] = $term-&gt;name;
    }   

    $form['industry_lens'] = array(
        '#type'             =&gt; 'select',
        '#options'          =&gt; $values,
        '#default_value'    =&gt; 0,
        '#required'         =&gt; TRUE,
        '#ajax'             =&gt; array(
            'callback'  =&gt; 'jms_industry_lens_form_ajax',
            'wrapper'   =&gt; 'edit-industry-lens-term',
        ),  
    );  

    $form['industry_lens_term'] = array(
        '#type'     =&gt; 'item',
        '#markup'   =&gt; _jms_render_term($terms[0]-&gt;tid),
        '#prefix'   =&gt; '&lt;div id="edit-industry-lens-term"&gt;',
        '#suffix'=&gt; '&lt;/div&gt;'
    );  

    return $form;
}

/**
 * Ajax callback to change the rendered industry lens taxonomy term
 */
function jms_industry_lens_form_ajax($form, &amp;$form_state) {
    $form['industry_lens_term']['#markup'] = _jms_render_term($form_state['values']['industry_lens']);

    return $form['industry_lens_term'];
}