【发布时间】:2012-01-06 10:34:39
【问题描述】:
我有一个表格 A 和一个表格 B。
我想让表单 A 将用户重定向到表单 B 并通知表单 B 在表单 A 中所做的选择
Form A的提交功能(不起作用):
function recruitment_select_team_submit($form, &$form_state)
{
// Forward to the next page.
$items['yourmod/foo/%/delete'] = array(
'title' => 'goto next page',
'page callback' => 'drupal_get_form',
'page arguments' => array('recruitment_form', 1), // second argument is the paramter for the team_id (test value)
//'access arguments' => array('delete foo rows'),
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
return $items;
}
表格B的表格:
function recruitment_form()
{
$team_id = 1;
if(db_query('select count(*) from gm_team where id = :team_id',array(':team_id' => $team_id))->fetchfield() == 0)
{
die('Sorry but the team with team ID '.$team_id.' does not exist. If you feel this is a mistake please contact us.');
}
$team_terms = db_query('select terms from gm_team where id = :team_id',array(':team_id' => $team_id))->fetchfield();
$team_requirements = db_query('select recruit_requirements from gm_team where id = :team_id',array(':team_id' => $team_id))->fetchfield();
......
}
【问题讨论】:
-
您可以使用 1) Db 将数据存储到两个表单都可以访问它的位置。 2)至于重定向,您可以使用 jquery 来做到这一点
-
This 可能会帮助你
-
hakanito 的链接是处理此问题的正确方法,除非您真的有充分的理由不将其设为多格式。
-
确实 hakanito 的链接是一个很好的解决方案。