点击浏览器“返回”按钮导致详细信息保存

发布于 2024-10-04 20:01:01 字数 127 浏览 2 评论 0原文

我收到了一位用户的报告,每当他们编辑个人资料详细信息时,如果他们在浏览器上点击“返回”,他们可能所做的任何更改都会被保存,而这些更改只能由他们单击“保存”来保存” 页面中的按钮。

发生这种情况的可能原因有哪些,我该如何预防?

I've had a report from a user that whenever they go to edit their profile details, if they hit "Back" on their browser, any changes they may have made are saved, when they should only be saved by them clicking the "Save" button in the page.

What possible reasons are there for this happening, and how can I prevent it?

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

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

发布评论

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

评论(2

情仇皆在手 2024-10-11 20:01:01

听起来像是表单重新提交问题。看看此处,看看这是否为您指明了正确的方向

Sound like a form resubmission issue. Have a look here and see if that points you in the right direction

无声情话 2024-10-11 20:01:01

如果用户双击“提交”按钮并触发两个表单提交,也会发生这种情况。

解决方案是在表单中添加一个字段,该字段是每次加载表单时生成的唯一参考 ID。

提交表单时,您的程序应记录此 ID 已被使用(可能将其存储在用户会话中),并拒绝任何使用相同 ID 发布表单的后续尝试。

实现此功能的方法有很多,因此我不会给您提供代码示例,但它应该相当简单。

希望有帮助。

This sort of thing can also happen if the user double-clicks on the 'submit' button and triggers two form submissions.

The solution to it is to have a field in the form which is a unique reference ID which is generated each time the form is loaded.

When the form is submitted, your program should make a note that this ID has been used (maybe store this in the user's session), and reject any subsequent attempts to post a form with the same ID.

There are many ways of implementing this, so I won't give you a code example, but it should be fairly straightforward.

Hope that helps.

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