I have a jsf
form which has a command Button and i am going to disable it when user clicked on it to prevent resubmit the form.
Here is commandButton
code:
<h:commandButton id="loginbtn" value="Sign in" action="#{loginBean.login()}"class="btn-myForm" onclick="myFunction()">
<f:ajax execute="@form" render="@form" />
</h:commandButton>
And here is myFunction()
script in jsf
form:
<script>
function myFunction() {
document.getElementById("loginbtn").disabled = true;
}
</script>
But myFunction()
not triggered when i click on button.