1
<p:commandButton id .......
onclick=”disableButton(this);”
onkeypress=”disableButton(this);”
oncomplete="enableButton('${bean.enableButton()}');"

private boolean enableButton(){
  return false;
}

<script>
function disableButton(data) {
  data.disable = true;
}

function enableButton(data) {
  data.disable = data;
}
</script>

Observed both calls working in the debugger, but the button remains disabled When disableButton is called data = button#MessageView j_idt183:…. When enableButton is called data = {url: “ ……….} from the debugger

Steve
  • 31
  • 4

1 Answers1

1
<p:commandButton id .......
   onclick=”disableButton(this);”
   onkeypress=”disableButton(this);”
   oncomplete="enableButton();"
<script>

function disableButton(data) {
  data.disable = true;
  window.buttonPressed.disabled = data
}
// Save and use the initial "data" object 
function enableButton() {
   window.buttonPressed.disabled = false;
}
Steve
  • 31
  • 4
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 13 '21 at 19:38