html本文の下部に関数を含む単純なスクリプトタグがあります。このスクリプトは、送信ボタンを無効にするだけです。次にonclick
、関数を呼び出すイベントがあります。
このコードは5つの異なるページにあり、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>
どんな助けでも大歓迎です。動作するページと動作しないページの唯一の違いは、action
とactionListeners
は異なるタイプのBeanであり、あるものf:params
とないものがあることです。