合并drupal中的两个表单字段

时间:2012-07-23 07:58:57

标签: php forms drupal

我正在将表单与另一个包含表格的表单合并。表格包含带复选框的列表,填写表格字段后,选中并提交复选框。

当我编写这段代码时,会生成两个具有相同id的表单,我应该如何以一种形式合并这两个函数。

function add_newHardware() {
        $output = drupal_get_form('add_new_form');
  return $output;
}

function add_new_form(&$form_state) {

 $form['#attributes']['id'] = 'myform';
  $form['device'] = array(
    '#type' => 'fieldset',
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );

  $form['device']['type'] = array(
'#type' => 'select',
  '#options' => listType(),

  );


 $form['device']['title'] = array(
'#type' => 'item',
      '#value' => '<h4>2. Enter Information</h4>',


  );
  $form['table'] = array(
    '#type' => 'item',
    '#value' => drupal_get_form('selectList'),
  ); 
}

function selectList() {
 $form['#attributes']['id'] = 'myform';
...... 
$output .= theme('table', $header, $rows);
 $output .= drupal_render($form);

 return $output;
}

0 个答案:

没有答案