I am trying to auto-assign book id (bid) on /node/add forms. I want to preselect the book so that the correct select element for pages populates on page load. I set:

$form['book']['#collapsed'] = 0;
$form['book']['bid']['#default_value'] = $project_nid;
$form['book']['bid']['#value'] = $project_nid;

The #collapsed worked so I am confident that I am altering the correct form. #value and #default_value do not have any effect. I was able to make some change in the display with:

function pm_content_input_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch( $op ) {
    case 'prepare':
      // Set $project_nid, code omitted

      // Set parent project (book)
      $node->book['original_bid'] = $project_nid;
      $node->book['bid'] = $project_nid;

Comments

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.