gpt4 book ai didi

java - 如何禁用 h :commandButton without preventing the action and actionListener from being called?

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:30:21 24 4
gpt4 key购买 nike

<分区>

我有一个简单的脚本标签,其中包含一个函数,我将其包含在 html 正文的底部。此脚本只是禁用提交按钮。然后我有一个调用该函数的 onclick 事件。

我在 5 个不同的页面中有这段代码,它在五个页面中的 3 个页面上工作。

代码如下:

<!-- more non-important html -->

<h:commandButton id="buttonToDisable"
value="some text"
action="#{myBean.myBeansAction}"
actionListener="#{myBean.myBeansActionListener}"
onclick="disableButton()">

<!-- I also have an f:param in some of these pages but I didn't
think that would matter -->

</h:commandButton>

<!-- more non-important html -->

<script>
function disabledButton() {
document.getElementById("myForm:buttonToDisable").disabled = 'true';
}
</script>

如有任何帮助,我们将不胜感激。页面工作和不工作的唯一区别是 actionactionListeners 是不同类型的 bean,有些有 f:params 而其他人则没有。

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com