How to set form type as 'hierarchical_select' programatically?
I think its better to use hierarchical_select for element as it gives a FORM API that is really easy to use. Check the following snippet as reference

$form['hierarchical_select'] = array(
    '#type' =&gt; 'fieldset',
    '#prefix' =&gt; '&lt;div id="hierarchical_select" class="hierarchical_select_wrapper"&gt;',
    '#suffix' =&gt; '&lt;/div&gt;',
    '#attributes' =&gt; array(
        'class' =&gt; array('hierarchical-select'),
    ),
);
$form['hierarchical_select']['select_subject'] = array(
    '#type' =&gt; 'hierarchical_select',
    '#title' =&gt; t('Select the tag you wish to use.'),
    '#size' =&gt; 1,
    '#config' =&gt; array(
        'module' =&gt; 'hs_taxonomy',
        'params' =&gt; array(
            'vid' =&gt; 13 //The vocab id
        ),
        'save_lineage' =&gt; 1,
        'enforce_deepest' =&gt; 0,
        'entity_count' =&gt; 0,
        'require_entity' =&gt; 0,
        'resizable' =&gt; 1,
        'level_labels' =&gt; array(
            'status' =&gt; 1,
            'labels' =&gt; array(
                0 =&gt; t('Grade'),
                1 =&gt; t('Subject'),
                2 =&gt; t('Main Topic'),
                3 =&gt; t('Sub Topic'),
                4 =&gt; t('Standard'),
                5 =&gt; t('Sub-Standard'),
            ),
        ),
        'dropbox' =&gt; array(
            'status' =&gt; 0,
            'title' =&gt; t('All selections'),
            'limit' =&gt; 0,
            'reset_hs' =&gt; 1,
        ),
        'editability' =&gt; array(
            'status' =&gt; 0,
            'item_types' =&gt; array(),
        ),
        'animation_delay' =&gt; 400,
        'special_items' =&gt; array(),
       'render_flat_select' =&gt; 0,
       'path' =&gt; 'hierarchical_select_json',
    ),
    '#default_value' =&gt; 0,
);


I hope this helps.