[英]How To disable a <h:commandButton> in jsf while form gets loading?
I am developing a web form using jsf. 我正在使用jsf开发Web表单。 In that i need to disable the while the form gets loading,then again it wil enable after completing the form loading 因为我需要在加载表单时禁用,然后在完成表单加载后再次启用
Put a <script>
right after the button which disables it. 在禁用该按钮的按钮之后放置<script>
。
<h:form id="myform">
<h:commandButton id="mybutton" />
<script>document.getElementById('myform:mybutton').disabled = true;</script>
On window.onload
, enable it again. 在window.onload
,再次启用它。 It doesn't matter where this script is placed. 放置此脚本的位置无关紧要。
<script>window.onload = function() { document.getElementById('myform:mybutton').disabled = false; }</script>
That can be done only on the client side, with javascript: 只能使用javascript在客户端完成此操作:
disabled="true"
或者实际上在一开始就通过设置disabled="true"
禁用它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.