如何从用户点击从两次按钮prevent(如果指定的onclick财产JSF命令按钮不执行动作) [英] How to prevent from user from clicking button twice(JSF command button not performing action if onclick property specified)

查看:136
本文介绍了如何从用户点击从两次按钮prevent(如果指定的onclick财产JSF命令按钮不执行动作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  <h:commandButton styleClass="button"  id="button_check" onclick="this.disabled=true;this.value='Please wait...';" action="#{pc_AMyBean.doCheckAction}" value="CHECK NOW"/> 

此命令按钮执行onclick事件,而不是调用的行动。这是JSF 1.2。
我的意思是禁用按钮,但不执行所需的操作。

this command button executing onclick event , but not calling action. it is JSF 1.2. I mean it is disabling the button but not executing the required action.

如何从提交表单的两倍prevent用户?如果是为了两个命令将得到提升。

How to prevent user from submitting the form twice? if it is order two orders will be raised.

能帮我。

推荐答案

我可能是因为你禁用按钮就是所谓的行动之前。尝试使用的setTimeout()像这样

I probably because you disable the button before your action is called. Try using setTimeout() like this

<h:commandButton styleClass="button"  id="button_check" 
   onclick="setTimeout('document.getElementById(\'' + this.id + '\').disabled=true;', 50);" 
   action="#{pc_AMyBean.doCheckAction}" value="CHECK NOW"/> 

这篇关于如何从用户点击从两次按钮prevent(如果指定的onclick财产JSF命令按钮不执行动作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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