如何检测提交中止/停止按钮? [英] How to detect submit abort / stop button?

查看:72
本文介绍了如何检测提交中止/停止按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


虽然我知道没有停止按钮处理程序,但我确实想知道表单提交是否中止。


当我提交页面时,我锁定了所有控件,因此不允许进一步编辑。如果中止(通过ESC键,停止按钮等)我希望页面再次打开。


这可能吗?


我想如果我展示动画GIF,也许onAbort就会被调用但事实并非如此(理所当然就是这样;有意义)。


有什么想法吗?谢谢!

Hi all,

While I understand there is no stop button handler, I do desire a way to know if a form submission was aborted.

When I submit my page, I lock down all of the controls so no further editing is allowed. If aborted (via ESC key, stop button, etc.) I''d like the page to open again.

Is this possible?

I thought that perhaps onAbort would be called if I displayed an animated GIF but that is not the case (and rightfully so; makes sense).

Any ideas? Thanks!

推荐答案

另外,我想有办法在Javascript中检查一下间隔内的东西...


setInterval(''someFunc()'',500);


函数someFunc(){

/ *

检查窗户的属性?文献?形成?导航器?

* /

}
Also, I was thinking there would be a way to check something in Javascript with intervals...

setInterval(''someFunc()'', 500);

function someFunc() {
/*
Check a property of window? document? form? navigator?
*/
}


如果有人停止表单的提交,他们必须处理它,而不是您。你不应该担心它。


如果你真的担心,不要禁用提交按钮。
If someone stops a form''s submission, they have to deal with it, not you. You shouldn''t worry about it.

If you''re really concerned, don''t disable the submission button.


你好V,


非常同意。


问题是当表单提交停止时,没有任何数据发布到服务器并且整个表单都被锁定,因此他们必须刷新页面 - 丢失所有数据。我必须锁定表单,以便在长时间提交操作期间,人们不会编辑字段并在附加数据消失时感到困惑(这种情况发生,相信我)。


虽然你和我很容易同意(并且我们这样做)按下停止按钮将您从我们的网络应用程序流中带走,向用户提供的数据仍然是那里。在他们面前 - 为什么我不能解决我的错误并再次按下提交?


虽然我很难说,我准备使用该文件。停止IE中的处理程序。


我昨晚花了4个小时寻找更便携的解决方案。我唯一的发现是Firefox将ESC键发送到窗口,所以我可以抓住它。
Hi V,

Much agreed.

The issue is that when the form submit is stopped, none of the data has been posted to the server and the entire form is locked down, so they have to refresh the page - losing all of their data. I have to lock down the form so that during a long submit operation, people don''t edit the fields and get confused when the additional data disappears (this happens, trust me).

While you and I can easily agree (and we do) that pressing "stop" takes you out of the flow of our web apps, to users the data is still "there" in front of them - why can''t I fix my mistake and press submit again?

While it pains me to say it, I''m prepared to use the document.stop handler in IE.

I spent 4 hours last night looking for a more portable solution. My only discovery was that Firefox sends the ESC key to the window so I can catch that.


这篇关于如何检测提交中止/停止按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆