在不同计算机上同时填写 drupal 表单会混淆不同计算机的 form_state 数据

发布于 2024-12-23 22:59:44 字数 1201 浏览 4 评论 0原文

我在自动取款机上遇到了一个非常困难的问题,一个我根本无法解释的问题。我真的希望这里有人能够阐明这个困境。

在我的网站上,我有一个自行开发的模块,可以显示某种注册表单。注册表由不同部分组成:

  1. 个人信息
  2. 教育信息
  3. 语言技能
  4. 本地/交流特定信息
  5. 一些可选的附加备注。

使用 AHAH 和 AHAH Helper 模块,我创建(读:编程)此表单为“多页”。它的顶部标题描述了您当前处于整个注册的哪个部分以及您尚未完成的部分。您可以使用上一个/下一个按钮在表单的不同页面之间导航。 这一切都是由 AHAH 控制的,我使用默认值“current_page”的隐藏表单元素来跟踪页面。无论如何,这有点离题了。

上述解释的重要部分是,所有不同部分的数据通过使用 form_state 变量保存在不同的页面中。 AHAH Helper 将先前在表单中输入的值保存在 form_state 的“存储”中。

目前部分用户在注册时似乎遇到以下问题: 当他们填写信息时,在 AHAH 调用完成后,表单中会触发一些 AHAH 调用(例如:按下一步按钮、检查电子邮件地址的有效性、检查生日是否 >= 17),其中的值已经填写的表单元素已被完全不同的值替换。 另一个人的名字、他的年龄、他的电子邮件地址等。即使这个人,我认为这就是正在发生的事情,正在另一台私人计算机上填写表格,显然是在不同的会话中。

我的用户无需登录网站即可使用此页面进行注册,我不确定这是否会导致问题?

无论如何,据我所知,只有当我尝试同时使用计算机上不同浏览器的不同数据填写表单时,我才能重现问题。在这种情况下,我可以设法破坏 form_state 数据。但是,由于用户位于不同的私人计算机上,这些计算机可能使用不同的会话/cookie/其他内容,因此 form_state 数据如何可能更改为另一台计算机的 form_state 数据填写表格??

我不明白这个?使用 AHAH(& AHAH Helper)来保持 form_state 是否存在某种固有的缺陷?如果有的话,有什么解决办法吗?我是否只是在模块代码中的某个地方犯了一个巨大的新手错误,导致表单无法正常工作?

请问有没有人可以对这个问题提供一点线索?我绝对、完全一无所知,我无法开始想象出了什么问题,以及如何甚至是否可以解决它。 请帮我! :S

提前致谢!

最好的问候,

汤姆

编辑: 这个问题描述了drupal 6.x中的一个问题

I'm having a very difficult problem atm, one that I can not explain... at all. I really hope someone here may be able to shed some light on this predicament.

On my website I have a self-developed module that displays some kind of registration form. The registration form consists of different parts:

  1. Personal information
  2. Educational Information
  3. Linguistic Skills
  4. Local/Exchange Specific information
  5. Some optional additional remarks.

Using AHAH and the AHAH Helper module I have created (read: programmed) this form to be 'multipage'. It has the header on top describing what part of the total registration you are currently in, and which parts you have yet to complete. You have a previous/next button to navigate between the different pages of the form.
This is all controlled by AHAH, and I keep track of the pages using a hidden form element with a default value 'current_page'. Anyway that is kind of besides the point.

The important part of the above explanation is that the data of all the different parts persists through the different pages by using the form_state variable. AHAH Helper keeps the previous values entered in the form saved in the 'storage' of the form_state.

Now some of the users seem to be experiencing the following problem upon registering:
While they are filling in their information, and some AHAH call is triggered in the form (e.g.: Pressing the next button, Checking the email address for validity, checking birthdate for >= 17) after the AHAH call is finished, the values within the form elements, that had already been filled in, have been replaced by completely different values.
A name of a different person, his age, his email address etc. Even though this person, I assume that this is what is happening, is filling out the form on a different, private computer, in obviously a different session.

My users do not have to login on the website in order to register using this page, I'm not sure if that is causing an issue?

Anyway, as far as I can tell, I can only recreate the problem when I try filling out the form with different data from different browsers on my computer, concurrently. In that case I can manage to corrupt the form_state data. But as the users are on different, private computers, which presumable use different sessions/cookies/what-not, how is it ever possible for form_state data to be changed to form_state data of another computer who is also filling out the form??

I don't get this? Is there some kind of inherent flaw in using AHAH (& AHAH Helper) for keeping the form_state? If there is, is there some kind of work around? Am I just making a huge newby mistake somewhere in my module code that prevents the form from working correctly?

Is there please, anybody, that can shed even a little bit of light at all on this problem? I am absolutely, and completely clue-less and I can not begin to imagine what is going wrong and how and even IF I can fix it at all.
Please help me! :S

Thanks in advance!

Best Regards,

Tom

Edit:
This problem describes a problem in drupal 6.x

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

以为你会在 2024-12-30 22:59:44

找到解决方案后,我正在回答我自己的问题(很久以前,但我忘记了这个问题)。

问题是不同计算机的 form_state 使用来自 drupal 的会话信息保持分开。
然而,对于未注册的用户来说,这似乎无法正确使用 AHAH 表单。

让用户在填写这些表格之前进行注册解决了所有并发问题。

I'm answering my own question after having found the solution (quite a while back, but I forgot about this question).

The problem is that the form_state for the different computers is kept apart using session information from drupal.
However, this did not seem to work correctly with the AHAH forms for users that were not registered.

Having users register before being able to fill in these forms solved all the concurrency issues.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文