Drupal 多步骤表单通过节点保存进行中断
我有一个自定义的多步骤表单,我通过 hook_nodeapi 添加到某些节点类型内容。它工作得很好,但有一个例外。
在测试过程中,我发现当我处于中间表单(例如,第 2 步,共 6 步)并更新另一个浏览器选项卡中的节点时,当我尝试继续下一步时,我的表单会恢复到步骤 1。同样,当发生 AHAH 事件时,我会收到错误,并且表单会完全消失。该错误表明在节点更新后从缓存检索表单存在问题,因为它无法检索表单参数。
您以前遇到过这种行为吗?和/或者您对我如何修复它有什么建议吗?这不是一个大问题,因为这些节点在生产方面可能不会经常更新,但对于它确实影响的人来说仍然是一个重大麻烦。
编辑:感谢您的回复。不幸的是我不能在一个块中包含这个表单。它必须位于节点内容本身内。经过进一步测试,我注意到幸运的是其他用户没有受到影响。只有在中间状态下更新节点的用户才会受到影响。由于这种情况极不可能在生产站点上发生,因此发生这种情况的影响很小,而且我目前没有时间进一步探讨这一点,我将暂时继续处理这种无法解释的行为。但如果有人能指出为什么会发生这种情况,我将不胜感激。
I have a custom multi-step form that I add to certain node type content via hook_nodeapi. It is working great, with one exception.
During testing, I've found that when I am in mid-form (say, step 2 of 6) and update the node in another browser tab, my form reverts to step 1 when I try to proceed to the next step. Similarly, when an AHAH event occurs, I get an error and the form disappears altogether. The error suggests there is a problem with retrieving the form from cache after a node update, as it's not able to retrieve the form parameters.
Have you encountered this behaviour before, and/or do you have any suggestions on how I might go about fixing it? It isn't a huge problem as these nodes likely won't be updated too often on the production side, but it would still be a significant nuisance to those it does affect.
Edit: Thanks for your response. Unfortunately I can't contain this form within a block. It must be within the node content itself. Upon further testing I noted that other users thankfully aren't affected. It is only the user that updates the node while in mid-form that is affected. As this is extremely unlikely to happen on the production site, the impact of such an occurrence would be minor, and I have no time at the moment to explore this further, I'm going to move on with this behaviour unexplained for now. But if anyone can point out why this is occurring, I'd appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,刚刚根据此处描述的多步骤形式尝试了您的情况 - http://zgadzaj.com/basic-drupal-multipart-form-example-with-previous-and-next-buttons - 但放入块并显示在节点页面上,甚至如果我在不同的选项卡中编辑此节点,我仍然可以在原始选项卡上的所有表单步骤之间导航,并保留所有已提交的值。所以我想说这可能取决于你的表单是如何构建的......
Well, have just tried your situation based on multistep form described here - http://zgadzaj.com/basic-drupal-multipart-form-example-with-previous-and-next-buttons - but put in the block and displayed on node page, and even if I edit this node in a different tab, I still can navigate between all form steps on the original tab, keeping all already submitted values. So I'd say it all probably depends how your form is being built...