Create relation between two select list for Hierarchical select option
Hope this will help you

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id){

//put your form id
if ($form_id == 'two_state_node_form')  {

    $options_first = dynamic_add_options();

   $value_dropdown_first = isset($form_state['triggering_element']['#value']) ? $form_state['triggering_element']['#value'] : key($options_first);

    $form['#validated'] = TRUE;
    //put your first field name
    $form['field_select_list_1']['und']['#options'] = $options_first;
    $form['field_select_list_1']['und']['#default_value'] = $value_dropdown_first;
    $form['field_select_list_1']['und']['#ajax'] = array(
    'event' =&gt; 'change',
    'callback' =&gt; 'dynamic_ajax_callback',
    'wrapper' =&gt; 'dropdown_second_replace',
 );
    //put your secon field name
  $form['field_select_list_2']['und']['#prefix'] = '&lt;div id="dropdown_second_replace"&gt;';
  $form['field_select_list_2']['und']['#suffix'] = '&lt;/div&gt;';
  $form['field_select_list_2']['und']['#options'] = dynamic_second_dropdown_options($value_dropdown_first);
  $form['field_select_list_2']['und']['#default_value'] = isset($form_state['values']['field_select_list_2']) ? $form_state['values']['field_select_list_2'] : '';
 }
}



function dynamic_ajax_callback($form, $form_state) {

    return $form['field_select_list_2'];
}


function dynamic_add_options() {
  return array(
        'None' =&gt; 'None',
        'Nokia' =&gt; 'Nokia',
        'Samsung' =&gt; 'Samsung',
        'HTC' =&gt; 'HTC',
        'Apple' =&gt; 'Apple'
    );
   return $options;      
}

function dynamic_second_dropdown_options($key = '') {
    $options = array(
        'None' =&gt; array(
            'None' =&gt; 'none',
             ),
        'Nokia' =&gt; array(
            'Lumia 520' =&gt; 'Lumia 520',
            'Lumia 620' =&gt; 'Lumia 620'
        ),
        'Samsung' =&gt; array(
            'Galaxy S3' =&gt; 'Galaxy S3',
            'Galaxy S4' =&gt; 'Galaxy S4'
        ),
        'HTC' =&gt; array(
            'Hero' =&gt; 'Hero',//trancate the code
            'One' =&gt; 'One'
        ),
        'Apple' =&gt; array(
            'iPhone 4' =&gt; 'iPhone 4',
            'iPhone 5' =&gt; 'iPhone 5'
        ),
    );
    if (isset($options[$key])) {
        return $options[$key];
    }
    else {
        return array();
    }
}


this is demo for you demo