Pre-populating a CCK field item with values from another field I'm working on a project that has two compound field ("flexifield," or "multifield," if you use CCK3) sections that output content types "rooms" and "levels".

Level is defined first and has a title, a total area and an "above ground" binary value.

Room has a length, width and area, then a level defined by a select box — populated by the first set of fields via the following "allowed value" code:

$result = db_query('SELECT `vid`, `field_level_label_value` FROM `drupal_content_type_meas_areas`;');
while ($item = db_fetch_object($result)) {
$items[$item-&gt;vid] = $item-&gt;field_level_label_value;
}
return $items;


Alas, while the proper label is available when filling in the fields, when actually viewing the content type, the value of each "level" field is a numerical value, instead of the label defined by the level's "field_level_label" field.

How do I make this field save the field's string value instead of its (I'm guessing) vid?

Thanks!
$result = db_query('SELECT `vid`, `field_level_label_value` FROM `drupal_content_type_meas_areas`;');
while ($item = db_fetch_object($result)) {
$items[] = $item-&gt;field_level_label_value;
}
return $items;


I figured it out -- removing the $item->vid bit as $items' array key results in the proper values. 

Oh Drupal, so subtle in its frustrations! :D