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

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

我正在开发一个对于多种表单来说很常见的模块。我需要将 $form_id 作为参数传递给提交处理程序,并在提交函数中相应地设置表单值。

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?

谢谢!

最佳答案

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

关于drupal - 如何将参数传递给 Drupal 中的表单提交处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9411682/

相关文章:

jquery - 当我移动 CKEditor 表单时出现问题

Drupal View : Get nodes with the same taxonomy as the current node

drupal - 从特定内容类型的页面中排除 CKEditor

javascript - 从较低的 div 获取背景图像 url 以将它们添加到较高的 div

html - 是否可以更改/覆盖 DRUPAL 模块的自动生成的 html 代码?

drupal - 如何为 Drupal 创建 RSS 源?

paypal - 如何获取 paypal 的实时 api 凭据?

php - Drupal 7 - 从本地主机发送电子邮件

drupal - 在哪里声明模块中不同包含文件共有的变量 - Drupal