Drupal 表单 ahah 元素,空 $_POST 问题
我正在为 ubercart 制作一个模块。它即将完成,但现在我正在管理页面上工作。我希望管理员能够添加选项,就像民意调查模块添加选择一样。我遇到的问题是管理表单是通过 drupal_get_form 生成的,这使得 $_POST
为空。似乎需要 $_POST['form_build_id'] 从缓存中获取表单。有没有办法可以在 drupal_get_form 之后访问 $_POST['form_build_id']
?我读到它可以保存到 $form_state
变量中,但我不知道如何保存。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
drupal_get_form()
将$_POST
数组保存到$form['#post']
中。如果您想了解 poll 模块如何添加选项,请查看
poll_choice_js()
,它不使用drupal_get_form()
,但是建筑本身。它帮助我理解了啊哈的过程。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 usedrupal_get_form()
, but does the building itself. It helped me understand the ahah process.