get form state values of forms which added via ajax the forms were added via ajax,but I just don't know how to get $values= $form_state['values']['field_name']; ,the result return nothing.Thanks in advance!

&lt;?php

/**
 * hook_menu()
 */

function addstudent_menu(){
    $items= array();
    $items['user/%/add-students'] = array(
        'title'=&gt;t('添加學生賬戶'),
        'page callback' =&gt;'drupal_get_form',
        'page arguments' =&gt; array(addstudent_form),
        'access arguments' =&gt; array('create new users'),
        'type' =&gt; MENU_LOCAL_TASK,


    );

    return $items;

}


function addstudent_form($form,&amp;$form_state){

    $dropdown_source = taxonomy_get_tree(3);
    if(!empty($dropdown_source)){
        $options = array('0'=&gt; '--none--');

        foreach($dropdown_source as $item){ //we get all class term here
            $key = $item-&gt;tid;
            $value =$item-&gt;name;
            $options[$key] = $value;
        }
    }else {
        drupal_set_message(t('你还没有创建任何班级'),'error');
    }


    $form['addstudent_wrapper'] = array(
        '#title' =&gt; t('添加學生賬戶'),
        '#type' =&gt;'fieldset',
        '#prefix'=&gt;'&lt;div id="fields_wrapper"&gt;',
        '#suffix'=&gt; '&lt;/div&gt;',

    );


    $form['addstudent_wrapper']['fields_head']['select_class'] = array(
        '#title'=&gt; t('班级'),
        '#type' =&gt; 'select',
        '#options'=&gt;$options
    );

    $form['addstudent_wrapper']['fields_head']['student_qty'] = array(
        '#title' =&gt; t('人數'),
        '#type'=&gt; 'textfield',
        '#size'=&gt; 10,

    );




    $form['addstudent_wrapper']['fields_head']['add'] = array(
        '#type' =&gt; 'submit',
        '#value'=&gt; '確認',
        '#ajax' =&gt; array(
            'callback' =&gt; 'addstudent_get_callback',
            'wrapper' =&gt;'fields_wrapper',

        ),
    );






    $form['addstudent_wrapper']['fields_wrapper']=array(
        '#tree' =&gt; TRUE,
    );





    return $form;

}




function addstudent_get_callback($form,&amp;$form_state){
    $form_state['rebulid'] = TRUE;
    $i = $form_state['values']['student_qty'];
    return $form['addstudent_wrapper']['fields_wrapper'] = _addstudent_fields($i);

}




function  _addstudent_fields($i){
    for($a=0;$a&lt;$i;$a++){

        $form[$a]['field_number'] = array(
            '#title' =&gt; '學號',
            '#markup'=&gt;$a+1,
            '#tree' =&gt;TRUE,
            '#type'=&gt;'markup'

        );

        $form[$a]['field_name'] = array(
            '#title' =&gt; '姓名',
            '#type'=&gt; 'textfield',
            '#tree' =&gt; TRUE,
            '#parents' =&gt; array('field_name', $i, 'field_name'),
            '#size'=&gt; 10,
            '#default_value'=&gt;''
        );
    }

    $form['addstudent_wrapper']['submit'] = array(
        '#type' =&gt; 'submit',
        '#value' =&gt; 'Confirm',
        '#submit' =&gt; array('addstudent_form_submit'),
    );


    return $form;
}

function addstudent_form_submit($form,&amp;$form_state){

    $values= $form_state['values']['field_name'];
    $a = array_values($values);
    foreach($a AS $b){
        foreach($b as $c){
            $r[] = $c;
        }
    }

    dsm($values);

}
Try $values= $form_state['values'];

and then dsm the values. You will get all field values of the form.

I think you should get the form values of ajax in $form_state['values']['addstudent_wrapper']['fields_wrapper'][0]['field_name'] and so on.