Using the code below in a block, I am displaying a form in a block on all pages for a content type called Goals. I want to use this block / form to update progress on the goal to a content type called Goal Progress, and connect the two through a key called goal_id - the nid of the Goal.
The challenge that I am having is setting the value for the goal_id field (Goal Progress content type). I suspect I need to use $form_state['values']['field_goal_id']['und']['0']['value'] = 'value'; to declare the value, but I can't figure out where that should be placed.
Been looking for a solution for a couple of hours now, so any suggestions are greatly appreciated.
<?php
$node = menu_get_object();
if (isset($node->nid)) {
$nid = $node->nid;
}
module_load_include('inc', 'node', 'node.pages');
$node_form = node_add('goal_progress');
print drupal_render($node_form);
?>