How to use HS in custom forms
bassam - October 22, 2009 - 13:07
| Project: | Hierarchical Select |
| Version: | 6.x-3.x-dev |
| Component: | Miscellaneous |
| Category: | support request |
| Priority: | normal |
| Assigned: | Wim Leers |
| Status: | closed |
Jump to:
Description
Hi,
I'm trying to build custom node edit forms. I want to use taxonomy HS and I want to spread out the fields in different fieldsets.
How can I do this? is there a documentation on this?
One other note, I want to be able to use the multiple terms select feature as well.
Thanks

#1
It's simply Forms API. Nothing special.
You can read in API.txt how to configure a HS form item.
#2
You're a life saver man.
Thanks a lot :)
#3
No problem :)
#4
Hi again, I used the code below and I ran into a problem. Not all of the terms are loaded. There are about 25 terms and when the form renders it only shows 4 items.
- A
- A1
- B
- B1
$form['institute_type'] = array(
'#type' => 'hierarchical_select',
'#title' => t('Institute Type'),
'#size' => 1,
'#config' => array(
'module' => 'hs_taxonomy',
'params' => array(
'vid' => 2,
'exclude_tid' => NULL,
'root_term' => NULL,
),
'save_lineage' => 0,
'enforce_deepest' => 1,
'entity_count' => 0,
'require_entity' => 1,
'resizable' => 0,
'level_labels' => array(
'status' => 0,
'labels' => array(
0 => t('Main category'),
1 => t('Subcategory'),
2 => t('Third level category'),
),
),
'dropbox' => array(
'status' => 0,
'title' => t('All selections'),
'limit' => 0,
'reset_hs' => 1,
),
'editability' => array(
'status' => 0,
'item_types' => array(),
'allowed_levels' => array( 0 => 1, 1 => 1, 2 => 1, ),
'allow_new_levels' => 0,
'max_levels' => 100,
),
// These settings cannot be configured through the UI: they can only be
// overridden through code.
'animation_delay' => 400,
'special_items' => array(),
'render_flat_select' => 0,
'path' => 'hierarchical_select_json',
),
'#default_value' => '',
);
#5
Sounds impossible.
Please make a screencast of it.
P.S.: don't have any screencast software yet? On Windows and Mac OS X, you can use the free Jing.
#6
Hope this helps
http://screencast.com/t/tZ0AVT9sU
#7
#8
Probably found it.
You have
'require_entity' => 1,in your configuration. This means that a node must be associated with a term before it will be shown. You probably don't have that enabled for the normal node form.
Set it to 0 and all terms will appear once again :)
#9
Thank a lot :)