I'm working on JSF, I'm unable to make action call after JavaScript (JS) execution. Without JS action is getting executed as expected. What is needed: Disable the command button until the action (submit) is performed. Below is the reference piece of code that i'm using.
<h:commandButton id = "search" value="Submit" action="#{ManagedBean.retrieve}"
onclick="return buttonDisable();" />
<script type="text/javascript">
function buttonDisable() {
document.getElementById('editForm:search').click();
document.getElementById('editForm:search').disabled = true;
document.getElementById('editForm:search').style.backgroundColor="#cccccc";
return true;
}
</script>
Tried many ways but could not find a solution yet. Your suggestions are much appreciated.