All pastes #768620 Raw Edit

Mine

public text v1 · immutable
·published 2007-11-10 19:14 UTC
rendered paste body
<?php 

// project_issue_form in project_issue does something like this...

    $form['project_info'] = array(
      '#type' => 'fieldset',
      '#title' => t('Project information'),
      '#prefix' => '<div class="inline-options">',
      '#suffix' => '</div>',
    );
    $form['project_info']['pid'] = array(
      '#type' => 'select',
      '#title' => t('Project'),
      '#default_value' => $node->project_issue['pid'],
      '#options' => $projects,
      '#required' => TRUE,
    );

// Then in node_validate, node_submit, node_save, etc, the resulting $node object is flat.  We're trying to accomplish this...

$node->project_issue['pid'] = xxx;

// So to fix, we need to rework the form like this...

    $form['project_info'] = array(
      '#type' => 'fieldset',
      '#title' => t('Project information'),
      '#prefix' => '<div class="inline-options">',
      '#suffix' => '</div>',
    );
    $form['project_info']['pid'] = array(
      '#parents' => array('project_issue','pid'),
      '#type' => 'select',
      '#title' => t('Project'),
      '#default_value' => $node->project_issue['pid'],
      '#options' => $projects,
      '#required' => TRUE,
    );

// And this is a pretty far-reaching change.

?>