代码禁用按钮以防止多次提交表单数据 [英] Code to disable button to prevent multiple submit of form data

查看:98
本文介绍了代码禁用按钮以防止多次提交表单数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI



我需要在用户点击它时禁用表单的SAVE按钮。这样就可以防止多次向服务器提交相同的数据。形式大约有60个字段,不可能通过1检查重复1





许多人提前感谢

HI

I need to disable the SAVE button of the form once user click on it.So that it will prevent multiple submission of same data to server.As there are around 60 field in form it is impossible to check duplicate 1 by 1.


Many many thanks in advance

推荐答案

有几种方法可以解决这个问题。您可以创建一个非提交类型的按钮,然后使onclick事件禁用该按钮。



您还可以捕获表单提交事件,并禁用提交按钮。





如果你以后遇到它,我发现再次启用按钮的最好方法是完全删除disabled属性,不要将它设置为false等。
There are several ways to go about this. You can make a button that is not of type submit, and then make the onclick event disable the button.

You can also catch the forms submit event, and disable the submit button.


In case you run into it later, the best way I have found to enable a button again is remove the disabled attribute altogether, not set it to false etc..


这篇关于代码禁用按钮以防止多次提交表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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