Drupal:在表单的提交处理程序中将输出发送给用户,而不是重定向
我有一个基本的 Drupal 场景和问题:
我有一个接受用户输入的表单,以及一个应该处理数据并向用户显示结果的提交处理程序。换句话说,我不在数据库中写入任何内容或设置变量等,只是向用户显示一些输出。 我想知道如何做到这一点,因为提交处理程序将流程重定向到另一个菜单项 - 该菜单项的表单值($form_state)不再可用。将表单重定向到自身没有用,因为我只收到原始发布的输入 - 未处理 $form_state。
如何防止重定向并仅在提交处理程序中向用户显示一些输出?
谢谢。
I have this basic Drupal scenario and question:
I have a form which accepts some input from user, and a submit handler which should process data and show the result to user. In other words, I don't write anything in database or set e variables etc., just show some output to user.
I was wondering how I can do this, because a submit handler redirects the flow to another menu item -which the form values ($form_state) are not available anymore. Redirecting form to itself is not useful, because I just receive the raw posted inputs -not processed $form_state.
How can I prevent the redirection and just show some output to user in submit handler?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您构建表单时,您希望将重定向设置为 false:
此处有更多有关重定向的信息:http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#redirect
如果我正确理解了你的问题这就是你所追求的。
When you are building your form you want to set re-direct to false:
There is more on redirect here: http://api.drupal.org/api/drupal/developer--topics--forms_api_reference.html/6#redirect
If I have understood your question correctly this is what you are after.