I have a select box that I want to populate with a particular taxonomy programmatically. If i was was to use a taxonomy vocabulary how would i populate a particular select box in my form. My form is generated using the from api and not using content types. If for example I was to have a vocabulary called countries. I have a select box which currently is configured like this
$form['status']['currentstatus'] = array ( '#values' => array(t('red'), ('green')) ); $form['status']['currentStatusList'] = array ( '#title' => 'current status', '#type' => 'select', '#options' => $form['status']['currentstatus']['#values'] );
Instead of just adding the values I would like to pass a vocabulary.
I have manged to get the vocabulary data but a zero is placed before the terms.
the code I figured out for the box is the same as yours. I even pass the id for the vocabulary. I will have a play with it thanks for your help