Drupal形成ahah元素,空的$ _POST问题 [英] Drupal form ahah element, problem with empty $_POST

查看:159
本文介绍了Drupal形成ahah元素,空的$ _POST问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为ubercart做一个模块。这几乎完成了,但现在我正在管理页面上工作。我希望管理员能够添加选项,如poll模块添加选项。我遇到的问题是,管理表单是通过drupal_get_form生成的,这将使 $ _ POST 为空。 $ _ POST ['form_build_id'] 似乎需要从缓存中获取表单。有没有办法可以在drupal_get_form之后访问 $ _ POST ['form_build_id'] ?我读到它可以保存到 $ form_state 变量,但我不知道如何。

解决方案

drupal_get_form() $ _ POST 数组保存到 $ form ['#post'] ,我想。



如果您想查看模块添加选项,请查看< a href =http://api.drupal.org/api/drupal/modules--poll--poll.module/function/poll_choice_js/6 =nofollow> poll_choice_js() ,它不使用 drupal_get_form(),而是建立本身。它帮助我理解了ahah过程。


I'm making a module for ubercart. It's nearly finished, but now I'm working on the admin page. I want the admin to be able to add options, like the poll module adds choices. The problem I have is that the admin form is generated through drupal_get_form, which leaves the $_POST empty. $_POST['form_build_id'] seems to be needed to get the form from cache. Is there a way that the $_POST['form_build_id'] can be accesses after a drupal_get_form? I read that it could be saved to the $form_state variable, but I don't know how.

解决方案

drupal_get_form() saves the $_POST array into $form['#post'], I think.

if you want to look at how poll module adds choices, have a look at poll_choice_js(), which doesn't use drupal_get_form(), but does the building itself. It helped me understand the ahah process.

这篇关于Drupal形成ahah元素,空的$ _POST问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆