I am building a custom form using the Form API. I want to show a nodereference_select in my form. However I have some difficulties setting the default value and the list of values.
//Create array of values
$items['6039']="MT";
// add field
$field = content_fields('field_nodereference_select');
$form['#field_info']['field_nodereference_select'] = $field;
$form += content_field_form($form, $form_state, $field);
$form['field_nodereference_select']['#weight'] = 6;
$form['field_nodereference_select']['#default_value']=$items;
$form['field_nodereference_select']['#options']=$items;
When I render the form I see the widget but without any values. When I am able to render the $items array, my next step would be to executing a view (because the nodereference_select is using a view to select certain values). and fill the $items array with the values.
Any help on this one?