如何将参数传递给Drupal中的表单提交处理程序

时间:2012-02-23 10:59:15

标签: drupal drupal-7 drupal-modules drupal-hooks drupal-forms

我正在研究一种常用于多种形式的模块。我需要将$ form_id作为参数传递给submit处理程序,并在submit函数中相应地设置表单值。

function ppi_form_alter(&$form, &$form_state, $form_id){

  $form['#submit'][]="action_form_submit";

}

function action_form_submit($form, &$form_state) {
  //here I need to get the form_id of the form and form_set_value accordingly ... How can I know the form value?
}

有没有办法知道form_submit中的form_id?

谢谢!

1 个答案:

答案 0 :(得分:2)

将其设置为hook_form_alter()中的隐藏字段, 然后像使用提交处理程序中的任何其他字段一样使用它

相关问题