我正在开发一个对于多种表单来说很常见的模块。我需要将 $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/