I have a simple script tag with a function that I include at the bottom of the html body. This script simply disables a submit button. I then have a onclick
event that calls the function.
I have this code in 5 different pages and it works on 3 of the five.
Here is the code:
<!-- 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>
Any help would be greatly appreciated. The only differences between the pages that do and don't work is that the action
and actionListeners
are different types of beans and some have f:params
and others don't.