I seem to struggle with a problem which has already been answered. I have a 'review' form on which there is a field that I want to prepopulate. It is a term reference field and I want it to be prepopulated with taxonomy values from another node. I have looked at this issue without success. Any help would be greatly appreciated.
function my_module_form_alter(&$form, &$form_state, $form_id) {
$nodeid=$_GET['id'];
$node=node_load($nodeid);
if ($form_id == 'review_node_form') {
$form['field_revactivities']['und'][0]['value']['#default_value'] = $node->field_ad_tags['und'][0]['tid'];
}
}
I know that '$node->field_ad_tags['und'][0]['tid']' returns the number of the term, but I am not sure how to get the value into the new field.
Also, if there are multiple terms for the field, should I populate the field for each term by incrementing [0], then ['1'], etc...?