I'm building a custom multistep form, where i want to get a term from a 2 level vocabulary. My vocabulary looks like:

town1
-district1
-district2
-district3
town2
town3
town4
-district21
-district22
town5

and so on.

I can get the terms, and the form renders smoothly and seems to work fine. It "seems" because i cannot get the value of the second level.

this is what the form entry looks like:

$form['step']['tid']=array(
   '#type'=>'hierarchical_select',
   '#title'=>t('Region'),
   '#options'=>$options,
   '#description'=>t('Choose District and then Municipality'),
   '#required'=>TRUE,
   '#hierarchical_select_settings'=> array(
       'module'=>'taxonomy',
       'params'=>array (
            'vid'=>'5',
       ),
   ),
);

When i print $form['step']['tid'] during validation i only get the value (tid) of the first level of taxonomy. I really cannot figure out what's going on!
I use the same vocabulary in a certain content type and it works perfectly!
Thanks in advance for any help!

Comments

porfyros’s picture

to be more specific, i only get the town value. When i select town4, i do get a second select with "district21" and "district22" but the $form['step']['tid'], doesn't get the tid of either "district21" or "district22".

wim leers’s picture

Is $options filled properly? Please post a dump of it.

porfyros’s picture

Wim you were right, i goofed!!! I also have various other vocabulariesin my form. So i filled the $options right for another vocabulary and thought that i did have checked it!
Thanks for your time and your module!

wim leers’s picture

Status: Active » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.