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
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

Wim Leers - October 22, 2009 - 13:55
Assigned to:Anonymous» Wim Leers
Status:active» fixed

It's simply Forms API. Nothing special.

You can read in API.txt how to configure a HS form item.

#2

bassam - October 22, 2009 - 14:39

You're a life saver man.

Thanks a lot :)

#3

Wim Leers - October 23, 2009 - 08:17

No problem :)

#4

bassam - October 24, 2009 - 11:46
Status:fixed» active

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

Wim Leers - October 24, 2009 - 13:09
Status:active» postponed (maintainer needs more info)

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

bassam - October 25, 2009 - 09:58

#7

bassam - October 25, 2009 - 13:45
Status:postponed (maintainer needs more info)» active

#8

Wim Leers - October 27, 2009 - 11:23
Status:active» fixed

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

bassam - October 27, 2009 - 14:05
Status:fixed» closed

Thank a lot :)

 
 

Drupal is a registered trademark of Dries Buytaert.